diff options
Diffstat (limited to 'src/mbgl/style/image.cpp')
-rw-r--r-- | src/mbgl/style/image.cpp | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/mbgl/style/image.cpp b/src/mbgl/style/image.cpp index 4c0c6a859b..1747de5fcc 100644 --- a/src/mbgl/style/image.cpp +++ b/src/mbgl/style/image.cpp @@ -1,21 +1,33 @@ #include <mbgl/style/image.hpp> +#include <mbgl/style/image_impl.hpp> #include <mbgl/util/exception.hpp> namespace mbgl { namespace style { -Image::Image(PremultipliedImage&& image_, - const float pixelRatio_, - bool sdf_) - : image(std::move(image_)), - pixelRatio(pixelRatio_), - sdf(sdf_) { - - if (!image.valid()) { - throw util::SpriteImageException("Sprite image dimensions may not be zero"); - } else if (pixelRatio <= 0) { - throw util::SpriteImageException("Sprite pixelRatio may not be <= 0"); - } +Image::Image(std::string id, + PremultipliedImage &&image, + const float pixelRatio, + bool sdf) + : baseImpl(makeMutable<Impl>(std::move(id), std::move(image), pixelRatio, sdf)) { +} + +std::string Image::getID() const { + return baseImpl->id; +} + +Image::Image(const Image&) = default; + +const PremultipliedImage& Image::getImage() const { + return baseImpl->image; +} + +bool Image::isSdf() const { + return baseImpl->sdf; +} + +float Image::getPixelRatio() const { + return baseImpl->pixelRatio; } } // namespace style |