diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-17 18:19:48 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-23 12:59:27 -0700 |
commit | 71c8f6aa10368084bc0a365b15f004d0629a8b67 (patch) | |
tree | 14f22e8b37c0ca5112f5c4cefe34e72882dee3b7 /src/mbgl/sprite | |
parent | 72b13cef6a83594b15f47bfeaee782504def619e (diff) | |
download | qtlocation-mapboxgl-71c8f6aa10368084bc0a365b15f004d0629a8b67.tar.gz |
[core] Move pattern coordinate division by texture size into shader
This makes pattern usage more like icons, and will be necessary for data-driven *-pattern properties.
Diffstat (limited to 'src/mbgl/sprite')
-rw-r--r-- | src/mbgl/sprite/sprite_atlas.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/sprite/sprite_atlas.hpp | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/mbgl/sprite/sprite_atlas.cpp b/src/mbgl/sprite/sprite_atlas.cpp index cc69bccdbe..bcf35050ab 100644 --- a/src/mbgl/sprite/sprite_atlas.cpp +++ b/src/mbgl/sprite/sprite_atlas.cpp @@ -18,7 +18,7 @@ static constexpr uint32_t padding = 1; SpriteAtlasElement::SpriteAtlasElement(Rect<uint16_t> rect_, const style::Image::Impl& image, - Size size_, float pixelRatio) + float pixelRatio) : pos(std::move(rect_)), sdf(image.sdf), relativePixelRatio(image.pixelRatio / pixelRatio), @@ -28,8 +28,8 @@ SpriteAtlasElement::SpriteAtlasElement(Rect<uint16_t> rect_, const float w = image.image.size.width / pixelRatio; const float h = image.image.size.height / pixelRatio; - 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 }}; + tl = {{ float(pos.x + padding), float(pos.y + padding) }}; + br = {{ float(pos.x + padding + w), float(pos.y + padding + h) }}; } SpriteAtlas::SpriteAtlas(Size size_, float pixelRatio_) @@ -142,7 +142,6 @@ optional<SpriteAtlasElement> SpriteAtlas::getImage(const std::string& id, return SpriteAtlasElement { *(entry.*entryRect), *entry.image, - size, pixelRatio }; } @@ -164,7 +163,6 @@ optional<SpriteAtlasElement> SpriteAtlas::getImage(const std::string& id, return SpriteAtlasElement { rect, *entry.image, - size, pixelRatio }; } diff --git a/src/mbgl/sprite/sprite_atlas.hpp b/src/mbgl/sprite/sprite_atlas.hpp index 832922df5a..52749d389b 100644 --- a/src/mbgl/sprite/sprite_atlas.hpp +++ b/src/mbgl/sprite/sprite_atlas.hpp @@ -20,7 +20,7 @@ class Context; class SpriteAtlasElement { public: - SpriteAtlasElement(Rect<uint16_t>, const style::Image::Impl&, Size size, float pixelRatio); + SpriteAtlasElement(Rect<uint16_t>, const style::Image::Impl&, float pixelRatio); Rect<uint16_t> pos; bool sdf; |