summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMolly Lloyd <molly@mapbox.com>2017-12-18 14:18:19 -0800
committerMolly Lloyd <molly@mapbox.com>2018-01-18 18:10:08 -0800
commite0cb8844335d3deeaccd8fcc5afce8116eb13ffa (patch)
tree084b69dbdfb7fda0619e54cc68ee7dcd19e3caa6
parent2b41759bc3335de1efb1f14f4db935f5e7289eac (diff)
downloadqtlocation-mapboxgl-e0cb8844335d3deeaccd8fcc5afce8116eb13ffa.tar.gz
fix DEM population, change border to int32
-rw-r--r--src/mbgl/geometry/dem_pyramid.cpp8
-rw-r--r--src/mbgl/geometry/dem_pyramid.hpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/mbgl/geometry/dem_pyramid.cpp b/src/mbgl/geometry/dem_pyramid.cpp
index 6d940bc3d3..eec9990e44 100644
--- a/src/mbgl/geometry/dem_pyramid.cpp
+++ b/src/mbgl/geometry/dem_pyramid.cpp
@@ -7,7 +7,7 @@ void DEMPyramid::buildLevels() {
while (true) {
auto& prev = levels.back();
const int32_t dim = std::ceil(prev.dim / 2);
- const size_t border = std::max<int32_t>(std::ceil(prev.border / 2), 1);
+ const int32_t border = std::max<int32_t>(std::ceil(prev.border / 2), 1);
if (dim == 1) {
break;
@@ -26,7 +26,7 @@ void DEMPyramid::buildLevels() {
void DEMPyramid::loadFromImage(PremultipliedImage& image){
assert(image.size.height == image.size.width);
- const size_t border = std::max<int32_t>(std::ceil(image.size.height / 2), 1);
+ const int32_t border = std::max<int32_t>(std::ceil(image.size.height / 2), 1);
Level first(image.size.height, border);
@@ -34,7 +34,7 @@ void DEMPyramid::loadFromImage(PremultipliedImage& image){
for (int32_t x = 0; x < first.dim; x++) {
const int32_t i = y * first.dim + x;
const int32_t j = i * 4;
- first.set(x, y, (image.data[j] * 256 * 256 + image.data[j+i] * 256 + image.data[j+2])/10 - 10000);
+ first.set(x, y, (image.data[j] * 256 * 256 + image.data[j+1] * 256 + image.data[j+2])/10 - 10000);
}
}
@@ -98,7 +98,7 @@ void DEMPyramid::backfillBorder(mbgl::DEMPyramid &borderTileData, int8_t dx, int
}
}
-DEMPyramid::Level::Level(int32_t dim_, size_t border_)
+DEMPyramid::Level::Level(int32_t dim_, int32_t border_)
: dim(dim_),
border(border_),
stride(dim + 2 * border),
diff --git a/src/mbgl/geometry/dem_pyramid.hpp b/src/mbgl/geometry/dem_pyramid.hpp
index 64d67821c4..e1039b2d27 100644
--- a/src/mbgl/geometry/dem_pyramid.hpp
+++ b/src/mbgl/geometry/dem_pyramid.hpp
@@ -14,7 +14,7 @@ class DEMPyramid {
public:
class Level {
public:
- Level(int32_t dim, size_t border);
+ Level(int32_t dim, int32_t border);
void set(const int32_t x, const int32_t y, const int32_t value) {
reinterpret_cast<int32_t*>(image.data.get())[idx(x, y)] = value + 65536;