diff options
author | Ansis Brammanis <brammanis@gmail.com> | 2016-01-15 17:39:08 -0800 |
---|---|---|
committer | Ansis Brammanis <brammanis@gmail.com> | 2016-01-19 18:23:21 -0800 |
commit | d34f8eb674b9753c47616f37ae88ff7a02f61ba0 (patch) | |
tree | c19cfd5ba6b68c229b6e395f9a62294ab33d46f9 /platform/osx | |
parent | 26faa6a5ade54c0a423aab84106876dc59be868f (diff) | |
download | qtlocation-mapboxgl-d34f8eb674b9753c47616f37ae88ff7a02f61ba0.tar.gz |
[core][ios][osx][android] make SpriteImage accept PremultipliedImage
the SpriteImage constructor signature changes from
SpriteImage(
uint16_t width, uint16_t height, float pixelRatio,
std::string&& data, bool sdf = false);
to
SpriteImage(PremultipliedImage&&, float pixelRatio, bool sdf = false)
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/src/MGLMapView.mm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm index 596b909fa2..9c32e7204d 100644 --- a/platform/osx/src/MGLMapView.mm +++ b/platform/osx/src/MGLMapView.mm @@ -1590,10 +1590,11 @@ public: // Get the image’s raw pixel data as an RGBA buffer. std::string pixelString((const char *)rep.bitmapData, rep.pixelsWide * rep.pixelsHigh * 4 /* RGBA */); - auto cSpriteImage = std::make_shared<mbgl::SpriteImage>((uint16_t)rep.pixelsWide, - (uint16_t)rep.pixelsHigh, - (float)(rep.pixelsWide / size.width), - std::move(pixelString)); + + mbgl::PremultipliedImage cPremultipliedImage(rep.pixelsWide, rep.pixelsHigh); + std::copy(rep.bitmapData, rep.bitmapData + cPremultipliedImage.size(), cPremultipliedImage.data.get()); + auto cSpriteImage = std::make_shared<mbgl::SpriteImage>(std::move(cPremultipliedImage), + (float)(rep.pixelsWide / size.width)); NSString *symbolName = [MGLAnnotationSpritePrefix stringByAppendingString:annotationImage.reuseIdentifier]; _mbglMap->addAnnotationIcon(symbolName.UTF8String, cSpriteImage); |