summaryrefslogtreecommitdiff
path: root/include/mbgl/map
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-11-24 10:07:18 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-11-25 15:57:36 -0800
commit0c1e378bc9555f6cf826bb38b1a36fa742f8ce9b (patch)
tree9aec8e4f475ff715645072503b3e0ec78f0573af /include/mbgl/map
parent2de0a351a0635192bd05116cebdf0103c2638d05 (diff)
downloadqtlocation-mapboxgl-0c1e378bc9555f6cf826bb38b1a36fa742f8ce9b.tar.gz
[core] Rewrite image handling
* Consolidate Image and StillImage * Typecheck unassociated vs premultiplied images * Rewrite default platform image decoding implementation
Diffstat (limited to 'include/mbgl/map')
-rw-r--r--include/mbgl/map/map.hpp4
-rw-r--r--include/mbgl/map/still_image.hpp19
-rw-r--r--include/mbgl/map/view.hpp6
3 files changed, 5 insertions, 24 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index c190088088..80b50c2fa4 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -2,6 +2,7 @@
#define MBGL_MAP_MAP
#include <mbgl/util/chrono.hpp>
+#include <mbgl/util/image.hpp>
#include <mbgl/map/update.hpp>
#include <mbgl/map/mode.hpp>
#include <mbgl/util/geo.hpp>
@@ -21,7 +22,6 @@ class FileSource;
class View;
class MapData;
class MapContext;
-class StillImage;
class SpriteImage;
class Transform;
class PointAnnotation;
@@ -58,7 +58,7 @@ public:
// Register a callback that will get called (on the render thread) when all resources have
// been loaded and a complete render occurs.
- using StillImageCallback = std::function<void(std::exception_ptr, std::unique_ptr<const StillImage>)>;
+ using StillImageCallback = std::function<void (std::exception_ptr, UnassociatedImage&&)>;
void renderStill(StillImageCallback callback);
// Triggers a synchronous render.
diff --git a/include/mbgl/map/still_image.hpp b/include/mbgl/map/still_image.hpp
deleted file mode 100644
index 36922fe95a..0000000000
--- a/include/mbgl/map/still_image.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef MBGL_MAP_STILL_IMAGE
-#define MBGL_MAP_STILL_IMAGE
-
-#include <mbgl/util/noncopyable.hpp>
-
-#include <cstdint>
-
-namespace mbgl {
-
-class StillImage : util::noncopyable {
-public:
- size_t width = 0;
- size_t height = 0;
- std::unique_ptr<uint8_t[]> pixels;
-};
-
-}
-
-#endif
diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp
index fadd035e49..68bde5fe30 100644
--- a/include/mbgl/map/view.hpp
+++ b/include/mbgl/map/view.hpp
@@ -2,14 +2,14 @@
#define MBGL_MAP_VIEW
#include <mbgl/util/chrono.hpp>
-#include <functional>
+#include <mbgl/util/image.hpp>
+#include <functional>
#include <memory>
namespace mbgl {
class Map;
-class StillImage;
enum MapChange : uint8_t {
MapChangeRegionWillChange = 0,
@@ -70,7 +70,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 std::unique_ptr<StillImage> readStillImage();
+ virtual UnassociatedImage readStillImage();
// Notifies a watcher of map x/y/scale/rotation changes.
// Must only be called from the same thread that caused the change.