summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-12-12 13:22:33 -0800
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-12-12 15:35:01 -0800
commita446b42328d44e809007f6266750d3d857de1bb1 (patch)
treecc92782cfe35bc9b1c4613ebeb963a8fa870217b
parent0ab8f9563b25001379ddcf79b4d8759a3998ca25 (diff)
downloadqtlocation-mapboxgl-a446b42328d44e809007f6266750d3d857de1bb1.tar.gz
Add comment
-rw-r--r--src/mbgl/renderer/sources/render_image_source.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp
index 0844db39d9..e2e742167b 100644
--- a/src/mbgl/renderer/sources/render_image_source.cpp
+++ b/src/mbgl/renderer/sources/render_image_source.cpp
@@ -133,8 +133,12 @@ void RenderImageSource::update(Immutable<style::Source::Impl> baseImpl_,
auto dMax = std::max(dx, dy);
double zoom = std::max(0.0, std::floor(-util::log2(dMax)));
- // Don't bother drawing the ImageSource unless it occupies >4 screen pixels
- enabled = dMax * std::pow(2.0, transformState.getZoom()) > 2.0 / util::tileSize;
+ // Only enable if the long side of the image is > 2 pixels. Resulting in a
+ // display of at least 2 x 1 px image
+ // dMax is in tile coordinate units at z0, so scale by util::EXTENT and then
+ // by 2^z to get geometry coordinates at the current zoom.
+ // 1 gc unit = tileSize / extent pixels.
+ enabled = dMax * std::pow( 2.0, transformState.getZoom()) * util::tileSize > 2.0;
if (!enabled) {
return;
}