diff options
author | Ansis Brammanis <brammanis@gmail.com> | 2016-01-15 17:39:08 -0800 |
---|---|---|
committer | Ansis Brammanis <brammanis@gmail.com> | 2016-01-19 18:23:21 -0800 |
commit | d34f8eb674b9753c47616f37ae88ff7a02f61ba0 (patch) | |
tree | c19cfd5ba6b68c229b6e395f9a62294ab33d46f9 /include | |
parent | 26faa6a5ade54c0a423aab84106876dc59be868f (diff) | |
download | qtlocation-mapboxgl-d34f8eb674b9753c47616f37ae88ff7a02f61ba0.tar.gz |
[core][ios][osx][android] make SpriteImage accept PremultipliedImage
the SpriteImage constructor signature changes from
SpriteImage(
uint16_t width, uint16_t height, float pixelRatio,
std::string&& data, bool sdf = false);
to
SpriteImage(PremultipliedImage&&, float pixelRatio, bool sdf = false)
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/sprite/sprite_image.hpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/include/mbgl/sprite/sprite_image.hpp b/include/mbgl/sprite/sprite_image.hpp index c5b063ff7f..4c375e58b9 100644 --- a/include/mbgl/sprite/sprite_image.hpp +++ b/include/mbgl/sprite/sprite_image.hpp @@ -3,6 +3,7 @@ #include <mbgl/util/noncopyable.hpp> #include <mbgl/util/geo.hpp> +#include <mbgl/util/image.hpp> #include <string> #include <memory> @@ -12,27 +13,18 @@ namespace mbgl { class SpriteImage : private util::noncopyable { public: - SpriteImage( - uint16_t width, uint16_t height, float pixelRatio, std::string&& data, bool sdf = false); + SpriteImage(PremultipliedImage&&, float pixelRatio, bool sdf = false); - // Logical dimensions of the sprite image. - const uint16_t width; - const uint16_t height; + PremultipliedImage image; // Pixel ratio of the sprite image. const float pixelRatio; - // Physical dimensions of the sprite image. - const uint16_t pixelWidth; - const uint16_t pixelHeight; - - // A string of an RGBA8 representation of the sprite. It must have exactly - // (width * ratio) * (height * ratio) * 4 (RGBA) bytes. The scan lines may - // not have gaps between them (i.e. stride == 0). - const std::string data; - // Whether this image should be interpreted as a signed distance field icon. const bool sdf; + + float getWidth() const { return image.width / pixelRatio; } + float getHeight() const { return image.height / pixelRatio; } }; } // namespace mbgl |