diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-15 14:09:06 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-16 12:26:35 -0700 |
commit | cc1ea759a681cadcfd06fd7bdda79ca6deb38c62 (patch) | |
tree | 97ece422b0516b11979c84b8136f95aeabb1aa91 /platform/macos/src | |
parent | c0f6e5ccefc67dbdaa6ab7c7ea75a2a2d0c3f2ae (diff) | |
download | qtlocation-mapboxgl-cc1ea759a681cadcfd06fd7bdda79ca6deb38c62.tar.gz |
[core, node, darwin, android, qt] Make image ID part of Image
More like Source and Layer.
Diffstat (limited to 'platform/macos/src')
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 2 | ||||
-rw-r--r-- | platform/macos/src/NSImage+MGLAdditions.h | 2 | ||||
-rw-r--r-- | platform/macos/src/NSImage+MGLAdditions.mm | 9 |
3 files changed, 7 insertions, 6 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index a36766b745..59951f946d 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -1949,7 +1949,7 @@ public: return; } - _mbglMap->addAnnotationImage(iconIdentifier.UTF8String, annotationImage.image.mgl_styleImage); + _mbglMap->addAnnotationImage([annotationImage.image mgl_styleImageWithIdentifier:iconIdentifier]); // Create a slop area with a “radius” equal to the annotation image’s entire // size, allowing the eventual click to be on any point within this image. diff --git a/platform/macos/src/NSImage+MGLAdditions.h b/platform/macos/src/NSImage+MGLAdditions.h index d3cc80615b..1bcec00e8b 100644 --- a/platform/macos/src/NSImage+MGLAdditions.h +++ b/platform/macos/src/NSImage+MGLAdditions.h @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN - (nullable instancetype)initWithMGLStyleImage:(const mbgl::style::Image *)image; -- (std::unique_ptr<mbgl::style::Image>)mgl_styleImage; +- (std::unique_ptr<mbgl::style::Image>)mgl_styleImageWithIdentifier:(NSString *)identifier; @end diff --git a/platform/macos/src/NSImage+MGLAdditions.mm b/platform/macos/src/NSImage+MGLAdditions.mm index fee3fe2751..6bb8fca68b 100644 --- a/platform/macos/src/NSImage+MGLAdditions.mm +++ b/platform/macos/src/NSImage+MGLAdditions.mm @@ -30,7 +30,7 @@ return self; } -- (std::unique_ptr<mbgl::style::Image>)mgl_styleImage { +- (std::unique_ptr<mbgl::style::Image>)mgl_styleImageWithIdentifier:(NSString *)identifier { // Create a bitmap image representation from the image, respecting backing // scale factor and any resizing done on the image at runtime. // http://www.cocoabuilder.com/archive/cocoa/82430-nsimage-getting-raw-bitmap-data.html#82431 @@ -40,9 +40,10 @@ mbgl::PremultipliedImage cPremultipliedImage({ static_cast<uint32_t>(rep.pixelsWide), static_cast<uint32_t>(rep.pixelsHigh) }); std::copy(rep.bitmapData, rep.bitmapData + cPremultipliedImage.bytes(), cPremultipliedImage.data.get()); - return std::make_unique<mbgl::style::Image>(std::move(cPremultipliedImage), - (float)(rep.pixelsWide / self.size.width), - [self isTemplate]); + return std::make_unique<mbgl::style::Image>([identifier UTF8String], + std::move(cPremultipliedImage), + (float)(rep.pixelsWide / self.size.width), + [self isTemplate]); } @end |