diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-21 14:52:19 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-24 15:52:28 -0700 |
commit | 5dd98df50ba1210b1eef0d8d6655713a725f2995 (patch) | |
tree | b289bb3cbad5d1c3076816f4891a057d6089fc93 /src/mbgl/style/image.cpp | |
parent | 6f708ac5458fe332e25ca398431928b7ff5ba404 (diff) | |
download | qtlocation-mapboxgl-5dd98df50ba1210b1eef0d8d6655713a725f2995.tar.gz |
[all] Rationalize style::Image
A style has a collection of images, just as it has collections of sources and layers.
* Name things appropriately
* Use std::unique_ptr
Diffstat (limited to 'src/mbgl/style/image.cpp')
-rw-r--r-- | src/mbgl/style/image.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mbgl/style/image.cpp b/src/mbgl/style/image.cpp new file mode 100644 index 0000000000..4c0c6a859b --- /dev/null +++ b/src/mbgl/style/image.cpp @@ -0,0 +1,22 @@ +#include <mbgl/style/image.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"); + } +} + +} // namespace style +} // namespace mbgl |