diff options
author | Molly Lloyd <molly@mapbox.com> | 2018-01-05 16:11:59 -0800 |
---|---|---|
committer | Molly Lloyd <molly@mapbox.com> | 2018-01-17 09:49:32 -0800 |
commit | 2e62dfc4d5cac1c0b16a12956352d53bb17e2684 (patch) | |
tree | 5e8fb218c1fd1cd443bcc561de3e141f4b7666e3 | |
parent | 7644e4bcc9becf385d181c77711311622732bf14 (diff) | |
download | qtlocation-mapboxgl-2e62dfc4d5cac1c0b16a12956352d53bb17e2684.tar.gz |
remove unused dem pyramid code
-rw-r--r-- | src/mbgl/geometry/dem_pyramid.cpp | 30 | ||||
-rw-r--r-- | src/mbgl/geometry/dem_pyramid.hpp | 10 |
2 files changed, 7 insertions, 33 deletions
diff --git a/src/mbgl/geometry/dem_pyramid.cpp b/src/mbgl/geometry/dem_pyramid.cpp index eec9990e44..eb17128bf3 100644 --- a/src/mbgl/geometry/dem_pyramid.cpp +++ b/src/mbgl/geometry/dem_pyramid.cpp @@ -3,26 +3,6 @@ namespace mbgl { -void DEMPyramid::buildLevels() { - while (true) { - auto& prev = levels.back(); - const int32_t dim = std::ceil(prev.dim / 2); - const int32_t border = std::max<int32_t>(std::ceil(prev.border / 2), 1); - - if (dim == 1) { - break; - } - Level next(dim, border); - prev.resample(next); - levels.emplace_back(std::move(next)); - } - - // Build remaining two levels. They aren't actually used in rendering, but we - // need them for OpenGL's mipmapping feature. - levels.emplace_back(2, 0); - levels.emplace_back(1, 0); -} - void DEMPyramid::loadFromImage(PremultipliedImage& image){ assert(image.size.height == image.size.width); @@ -64,6 +44,7 @@ void DEMPyramid::loadFromImage(PremultipliedImage& image){ first.set(first.dim, first.dim, first.get(first.dim - 1, first.dim - 1)); levels.emplace_back(std::move(first)); + loaded = true; } void DEMPyramid::backfillBorder(mbgl::DEMPyramid &borderTileData, int8_t dx, int8_t dy) { @@ -110,14 +91,5 @@ DEMPyramid::Level::Level(int32_t dim_, int32_t border_) -void DEMPyramid::Level::resample(Level& target) { - for (int32_t y = 0; y < target.dim; y++) { - const int32_t fy = y * 2; - for (int32_t x = 0; x < target.dim; x++) { - const int32_t fx = x * 2; - target.set(x, y, (get(fx, fy) + get(fx + 1, fy) + get(fx, fy + 1) + get(fx + 1, fy + 1)) / 4); - } - } -} } // namespace mbgl diff --git a/src/mbgl/geometry/dem_pyramid.hpp b/src/mbgl/geometry/dem_pyramid.hpp index e1039b2d27..ba4d5e3ef0 100644 --- a/src/mbgl/geometry/dem_pyramid.hpp +++ b/src/mbgl/geometry/dem_pyramid.hpp @@ -24,7 +24,6 @@ public: return reinterpret_cast<const int32_t*>(image.data.get())[idx(x, y)] - 65536; } - void resample(Level& target); private: size_t idx(const int32_t x, const int32_t y) const { @@ -42,12 +41,15 @@ public: PremultipliedImage image; }; - void buildLevels(); + void loadFromImage(PremultipliedImage& image); void backfillBorder(DEMPyramid& borderTileData, int8_t dx, int8_t dy); - + bool isLoaded() { + return loaded; + }; std::vector<Level> levels; - + private: + bool loaded = false; }; |