From 1759603e128ad0a08f4a25009b82695420ec2840 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 18 May 2017 09:37:21 -0700 Subject: [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 --- src/mbgl/layout/symbol_layout.cpp | 3 ++- src/mbgl/layout/symbol_layout.hpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mbgl/layout') 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()->impl().layout.get()), @@ -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().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; -- cgit v1.2.1