diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-10-31 17:06:32 -0400 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-10-31 17:06:32 -0400 |
commit | 16bd75c6ccc0340295d65e04728239a7eea693dd (patch) | |
tree | ba633465bfcef203be726fc023a48d3f9239a0ba /include/mbgl/util/image.hpp | |
parent | bc7effdd8646d2492cf276d9a87828e784eb8945 (diff) | |
parent | d0f71242da3e5a84e3c0ba54d63a889da7a11f2e (diff) | |
download | qtlocation-mapboxgl-16bd75c6ccc0340295d65e04728239a7eea693dd.tar.gz |
Merge pull request #527 from mapbox/platform-image
Use platform-specific routines for decoding/encoding images
Diffstat (limited to 'include/mbgl/util/image.hpp')
-rw-r--r-- | include/mbgl/util/image.hpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp index dc8f6a8150..b2f70e1442 100644 --- a/include/mbgl/util/image.hpp +++ b/include/mbgl/util/image.hpp @@ -2,31 +2,29 @@ #define MBGL_UTIL_IMAGE #include <string> -#include <cstring> -#include <stdexcept> +#include <memory> namespace mbgl { namespace util { -std::string compress_png(int width, int height, void *rgba, bool flip = false); +std::string compress_png(int width, int height, void *rgba); class Image { public: - Image(const std::string &img, bool flip = false); - ~Image(); + Image(const std::string &img); - inline const char *getData() const { return img; } + inline const char *getData() const { return img.get(); } inline uint32_t getWidth() const { return width; } inline uint32_t getHeight() const { return height; } + inline operator bool() const { return img && width && height; } private: // loaded image dimensions uint32_t width = 0, height = 0; // the raw image data - char *img = nullptr; - + std::unique_ptr<char[]> img; }; |