diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-18 09:37:21 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-23 12:59:27 -0700 |
commit | 1759603e128ad0a08f4a25009b82695420ec2840 (patch) | |
tree | 77d74c683ca34efc25bd79cbb25774049dbfc695 /src/mbgl/text/shaping.cpp | |
parent | 9e1cbbeacb4007f9c7919185df0aae90fc8f7ad1 (diff) | |
download | qtlocation-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/text/shaping.cpp')
-rw-r--r-- | src/mbgl/text/shaping.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mbgl/text/shaping.cpp b/src/mbgl/text/shaping.cpp index 6ee646be96..f9f90627d4 100644 --- a/src/mbgl/text/shaping.cpp +++ b/src/mbgl/text/shaping.cpp @@ -13,10 +13,10 @@ namespace mbgl { PositionedIcon PositionedIcon::shapeIcon(const SpriteAtlasElement& image, const std::array<float, 2>& iconOffset, const float iconRotation) { float dx = iconOffset[0]; float dy = iconOffset[1]; - float x1 = dx - image.size[0] / 2.0f; - float x2 = x1 + image.size[0]; - float y1 = dy - image.size[1] / 2.0f; - float y2 = y1 + image.size[1]; + float x1 = dx - image.displaySize()[0] / 2.0f; + float x2 = x1 + image.displaySize()[0]; + float y1 = dy - image.displaySize()[1] / 2.0f; + float y2 = y1 + image.displaySize()[1]; return PositionedIcon { image, y1, y2, x1, x2, iconRotation }; } |