[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
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#include <mbgl/util/logging.hpp>
|
||||
#include <mbgl/util/platform.hpp>
|
||||
#include <mbgl/util/projection.hpp>
|
||||
#include <mbgl/sprite/sprite_image.hpp>
|
||||
#include <mbgl/style/image.hpp>
|
||||
#include <mbgl/style/filter.hpp>
|
||||
|
||||
// Java -> C++ conversion
|
||||
@@ -735,12 +735,12 @@ void NativeMapView::addAnnotationIcon(JNIEnv& env, jni::String symbol, jint w, j
|
||||
}
|
||||
|
||||
jni::GetArrayRegion(env, *jpixels, 0, size, reinterpret_cast<jbyte*>(premultipliedImage.data.get()));
|
||||
auto iconImage = std::make_shared<mbgl::SpriteImage>(std::move(premultipliedImage), float(scale));
|
||||
map->addAnnotationIcon(symbolName, iconImage);
|
||||
map->addAnnotationImage(symbolName,
|
||||
std::make_unique<mbgl::style::Image>(std::move(premultipliedImage), float(scale)));
|
||||
}
|
||||
|
||||
jdouble NativeMapView::getTopOffsetPixelsForAnnotationSymbol(JNIEnv& env, jni::String symbolName) {
|
||||
return map->getTopOffsetPixelsForAnnotationIcon(jni::Make<std::string>(env, symbolName));
|
||||
return map->getTopOffsetPixelsForAnnotationImage(jni::Make<std::string>(env, symbolName));
|
||||
}
|
||||
|
||||
jlong NativeMapView::getTransitionDuration(JNIEnv&) {
|
||||
@@ -1036,9 +1036,9 @@ void NativeMapView::addImage(JNIEnv& env, jni::String name, jni::jint w, jni::ji
|
||||
}
|
||||
|
||||
jni::GetArrayRegion(env, *pixels, 0, size, reinterpret_cast<jbyte*>(premultipliedImage.data.get()));
|
||||
auto spriteImage = std::make_unique<mbgl::SpriteImage>(std::move(premultipliedImage), float(scale));
|
||||
|
||||
map->addImage(jni::Make<std::string>(env, name), std::move(spriteImage));
|
||||
map->addImage(jni::Make<std::string>(env, name),
|
||||
std::make_unique<mbgl::style::Image>(std::move(premultipliedImage), float(scale)));
|
||||
}
|
||||
|
||||
void NativeMapView::removeImage(JNIEnv& env, jni::String name) {
|
||||
|
||||
Reference in New Issue
Block a user