summaryrefslogtreecommitdiff
path: root/src/mbgl/sprite/sprite_image.cpp
blob: d7e422ed1d357558031df96b0651961a918f1cf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <mbgl/sprite/sprite_image.hpp>

#include <mbgl/util/exception.hpp>

#include <cmath>

namespace mbgl {

SpriteImage::SpriteImage(PremultipliedImage&& image_,
                         const float pixelRatio_,
                         bool sdf_)
    : image(std::move(image_)),
      pixelRatio(pixelRatio_),
      sdf(sdf_) {

    if (image.size() == 0) {
        throw util::SpriteImageException("Sprite image dimensions may not be zero");
    } else if (pixelRatio <= 0) {
        throw util::SpriteImageException("Sprite pixelRatio may not be <= 0");
    }
}

} // namespace mbgl