summaryrefslogtreecommitdiff
path: root/src/mbgl/layout
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-05-18 09:37:21 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-05-23 12:59:27 -0700
commit1759603e128ad0a08f4a25009b82695420ec2840 (patch)
tree77d74c683ca34efc25bd79cbb25774049dbfc695 /src/mbgl/layout
parent9e1cbbeacb4007f9c7919185df0aae90fc8f7ad1 (diff)
downloadqtlocation-mapboxgl-1759603e128ad0a08f4a25009b82695420ec2840.tar.gz
[core] Simplify and fix sprite atlas coordinate calculations
* Always return image metrics exclusive of padding * Work with integer coordinates whenever possible * Eliminate redundant SpriteAtlasElement members * Fix asymmetric re-padding in getIconQuad when pixelRatio != 1 * Add explanatory comments
Diffstat (limited to 'src/mbgl/layout')
-rw-r--r--src/mbgl/layout/symbol_layout.cpp3
-rw-r--r--src/mbgl/layout/symbol_layout.hpp1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index bd9dbbc607..b1cfc113fb 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -48,6 +48,7 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters,
overscaling(parameters.tileID.overscaleFactor()),
zoom(parameters.tileID.overscaledZ),
mode(parameters.mode),
+ pixelRatio(parameters.pixelRatio),
tileSize(util::tileSize * overscaling),
tilePixelRatio(float(util::EXTENT) / tileSize),
textSize(layers.at(0)->as<RenderSymbolLayer>()->impl().layout.get<TextSize>()),
@@ -270,7 +271,7 @@ void SymbolLayout::prepare(const GlyphPositionMap& glyphs, const IconMap& icons)
if (image->second.sdf) {
sdfIcons = true;
}
- if (image->second.relativePixelRatio != 1.0f) {
+ if (image->second.pixelRatio != pixelRatio) {
iconsNeedLinear = true;
} else if (layout.get<IconRotate>().constantOr(1) != 0) {
iconsNeedLinear = true;
diff --git a/src/mbgl/layout/symbol_layout.hpp b/src/mbgl/layout/symbol_layout.hpp
index 7bdcf52f91..770820542d 100644
--- a/src/mbgl/layout/symbol_layout.hpp
+++ b/src/mbgl/layout/symbol_layout.hpp
@@ -78,6 +78,7 @@ private:
const float overscaling;
const float zoom;
const MapMode mode;
+ const float pixelRatio;
style::SymbolLayoutProperties::PossiblyEvaluated layout;