summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-21 14:52:19 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-24 15:52:28 -0700
commit5dd98df50ba1210b1eef0d8d6655713a725f2995 (patch)
treeb289bb3cbad5d1c3076816f4891a057d6089fc93 /include
parent6f708ac5458fe332e25ca398431928b7ff5ba404 (diff)
downloadqtlocation-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 'include')
-rw-r--r--include/mbgl/map/map.hpp14
-rw-r--r--include/mbgl/style/image.hpp (renamed from include/mbgl/sprite/sprite_image.hpp)12
2 files changed, 11 insertions, 15 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index 26ac154b8b..0e3cee4e70 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -25,9 +25,9 @@ class Backend;
class View;
class FileSource;
class Scheduler;
-class SpriteImage;
namespace style {
+class Image;
class Source;
class Layer;
} // namespace style
@@ -154,9 +154,9 @@ public:
LatLng latLngForPixel(const ScreenCoordinate&) const;
// Annotations
- void addAnnotationIcon(const std::string&, std::shared_ptr<const SpriteImage>);
- void removeAnnotationIcon(const std::string&);
- double getTopOffsetPixelsForAnnotationIcon(const std::string&);
+ void addAnnotationImage(const std::string&, std::unique_ptr<style::Image>);
+ void removeAnnotationImage(const std::string&);
+ double getTopOffsetPixelsForAnnotationImage(const std::string&);
AnnotationID addAnnotation(const Annotation&);
void updateAnnotation(AnnotationID, const Annotation&);
@@ -174,10 +174,10 @@ public:
void addLayer(std::unique_ptr<style::Layer>, const optional<std::string>& beforeLayerID = {});
std::unique_ptr<style::Layer> removeLayer(const std::string& layerID);
- // Add image, bound to the style
- void addImage(const std::string&, std::unique_ptr<const SpriteImage>);
+ // Images
+ void addImage(const std::string&, std::unique_ptr<style::Image>);
void removeImage(const std::string&);
- const SpriteImage* getImage(const std::string&);
+ const style::Image* getImage(const std::string&);
// Defaults
std::string getStyleName() const;
diff --git a/include/mbgl/sprite/sprite_image.hpp b/include/mbgl/style/image.hpp
index 05d9871bf9..499377467e 100644
--- a/include/mbgl/sprite/sprite_image.hpp
+++ b/include/mbgl/style/image.hpp
@@ -1,18 +1,13 @@
#pragma once
-#include <mbgl/util/noncopyable.hpp>
-#include <mbgl/util/geo.hpp>
#include <mbgl/util/image.hpp>
-#include <string>
-#include <memory>
-#include <cstdint>
-
namespace mbgl {
+namespace style {
-class SpriteImage : private util::noncopyable {
+class Image {
public:
- SpriteImage(PremultipliedImage&&, float pixelRatio, bool sdf = false);
+ Image(PremultipliedImage&&, float pixelRatio, bool sdf = false);
PremultipliedImage image;
@@ -26,4 +21,5 @@ public:
float getHeight() const { return image.size.height / pixelRatio; }
};
+} // namespace style
} // namespace mbgl