summaryrefslogtreecommitdiff
path: root/include/mbgl/sprite
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/sprite')
-rw-r--r--include/mbgl/sprite/sprite_image.hpp20
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