diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-16 15:53:59 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-17 11:23:47 -0700 |
commit | e7154adac3985b8d877c40d16c7d4b3916c7246b (patch) | |
tree | d68c579d078488b5ace871eb8d540d5c6f630de4 /src | |
parent | 786707649a2efcddd24fb976150b044097d74219 (diff) | |
download | qtlocation-mapboxgl-e7154adac3985b8d877c40d16c7d4b3916c7246b.tar.gz |
[core] Remove redundant SpriteAtlasElement members
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/sprite/sprite_atlas.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/sprite/sprite_atlas.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/text/shaping.cpp | 8 |
3 files changed, 6 insertions, 10 deletions
diff --git a/src/mbgl/sprite/sprite_atlas.cpp b/src/mbgl/sprite/sprite_atlas.cpp index 20c062a779..cc69bccdbe 100644 --- a/src/mbgl/sprite/sprite_atlas.cpp +++ b/src/mbgl/sprite/sprite_atlas.cpp @@ -22,14 +22,12 @@ SpriteAtlasElement::SpriteAtlasElement(Rect<uint16_t> rect_, : pos(std::move(rect_)), sdf(image.sdf), relativePixelRatio(image.pixelRatio / pixelRatio), - width(image.image.size.width / image.pixelRatio), - height(image.image.size.height / image.pixelRatio) { - + size{{image.image.size.width / image.pixelRatio, + image.image.size.height / image.pixelRatio}} { const float w = image.image.size.width / pixelRatio; const float h = image.image.size.height / pixelRatio; - size = {{ width, height }}; tl = {{ float(pos.x + padding) / size_.width, float(pos.y + padding) / size_.height }}; br = {{ float(pos.x + padding + w) / size_.width, float(pos.y + padding + h) / size_.height }}; } diff --git a/src/mbgl/sprite/sprite_atlas.hpp b/src/mbgl/sprite/sprite_atlas.hpp index bcec26b7ba..f1681608d1 100644 --- a/src/mbgl/sprite/sprite_atlas.hpp +++ b/src/mbgl/sprite/sprite_atlas.hpp @@ -29,8 +29,6 @@ public: std::array<float, 2> size; std::array<float, 2> tl; std::array<float, 2> br; - float width; - float height; }; using IconMap = std::unordered_map<std::string, SpriteAtlasElement>; diff --git a/src/mbgl/text/shaping.cpp b/src/mbgl/text/shaping.cpp index 78aa142c61..5c99a49133 100644 --- a/src/mbgl/text/shaping.cpp +++ b/src/mbgl/text/shaping.cpp @@ -17,10 +17,10 @@ optional<PositionedIcon> PositionedIcon::shapeIcon(const SpriteAtlasElement& ima float dx = iconOffset[0]; float dy = iconOffset[1]; - float x1 = dx - image.width/ 2.0f; - float x2 = x1 + image.width; - float y1 = dy - image.height / 2.0f; - float y2 = y1 + image.height; + 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]; return { PositionedIcon { image, y1, y2, x1, x2, iconRotation } }; } |