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/qt | |
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/qt')
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index bfc014dcd0..01471bf733 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -78,7 +78,7 @@ mbgl::Size sanitizedSize(const QSize& size) { }; }; -std::unique_ptr<mbgl::style::Image> toStyleImage(const QImage &sprite) { +std::unique_ptr<mbgl::style::Image> toStyleImage(const QString &id, const QImage &sprite) { const QImage swapped = sprite .rgbSwapped() .convertToFormat(QImage::Format_ARGB32_Premultiplied); @@ -87,6 +87,7 @@ std::unique_ptr<mbgl::style::Image> toStyleImage(const QImage &sprite) { memcpy(img.get(), swapped.constBits(), swapped.byteCount()); return std::make_unique<mbgl::style::Image>( + id.toStdString(), mbgl::PremultipliedImage( { static_cast<uint32_t>(swapped.width()), static_cast<uint32_t>(swapped.height()) }, std::move(img)), @@ -1027,7 +1028,7 @@ void QMapboxGL::addAnnotationIcon(const QString &name, const QImage &icon) { if (icon.isNull()) return; - d_ptr->mapObj->addAnnotationImage(name.toStdString(), toStyleImage(icon)); + d_ptr->mapObj->addAnnotationImage(toStyleImage(name, icon)); } /*! @@ -1329,7 +1330,7 @@ void QMapboxGL::addImage(const QString &id, const QImage &image) { if (image.isNull()) return; - d_ptr->mapObj->addImage(id.toStdString(), toStyleImage(image)); + d_ptr->mapObj->addImage(toStyleImage(id, image)); } /*! |