diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-08-22 17:57:22 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-09-27 10:42:10 +0200 |
commit | 63e53de157e75e504a6bf1a678cebaea5acf72b9 (patch) | |
tree | 234cb14695f21df69012f1470ee512b8fc8d9904 /include | |
parent | 512037cfdc14fb1f7686254efe97b72433c5e4b6 (diff) | |
download | qtlocation-mapboxgl-63e53de157e75e504a6bf1a678cebaea5acf72b9.tar.gz |
[core] standardize on uint16_t for texture sizes
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/map/view.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/platform/default/headless_view.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/util/image.hpp | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp index fa6f91d910..590eef7237 100644 --- a/include/mbgl/map/view.hpp +++ b/include/mbgl/map/view.hpp @@ -52,7 +52,7 @@ public: // Reads the pixel data from the current framebuffer. If your View implementation // doesn't support reading from the framebuffer, return a null pointer. - virtual PremultipliedImage readStillImage(); + virtual PremultipliedImage readStillImage(std::array<uint16_t, 2> size = {{ 0, 0 }}); // Notifies a watcher of map x/y/scale/rotation changes. virtual void notifyMapChange(MapChange change); diff --git a/include/mbgl/platform/default/headless_view.hpp b/include/mbgl/platform/default/headless_view.hpp index 89716643d4..c0ffd27fbf 100644 --- a/include/mbgl/platform/default/headless_view.hpp +++ b/include/mbgl/platform/default/headless_view.hpp @@ -45,7 +45,7 @@ public: void deactivate() override; void notifyMapChange(MapChange) override; - PremultipliedImage readStillImage() override; + PremultipliedImage readStillImage(std::array<uint16_t, 2> size = {{ 0, 0 }}) override; void resize(uint16_t width, uint16_t height); void setMapChangeCallback(std::function<void(MapChange)>&& cb) { mapChangeCallback = std::move(cb); } diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp index 124cdca7cd..795d1f9d1a 100644 --- a/include/mbgl/util/image.hpp +++ b/include/mbgl/util/image.hpp @@ -18,12 +18,12 @@ class Image : private util::noncopyable { public: Image() = default; - Image(size_t w, size_t h) + Image(uint16_t w, uint16_t h) : width(w), height(h), data(std::make_unique<uint8_t[]>(size())) {} - Image(size_t w, size_t h, std::unique_ptr<uint8_t[]> data_) + Image(uint16_t w, uint16_t h, std::unique_ptr<uint8_t[]> data_) : width(w), height(h), data(std::move(data_)) {} @@ -46,11 +46,11 @@ public: rhs.data.get() + rhs.size()); } - size_t stride() const { return width * 4; } - size_t size() const { return width * height * 4; } + size_t stride() const { return static_cast<size_t>(width) * 4; } + size_t size() const { return static_cast<size_t>(width) * height * 4; } - size_t width = 0; - size_t height = 0; + uint16_t width = 0; + uint16_t height = 0; std::unique_ptr<uint8_t[]> data; }; |