[core] Loading images to style optimization
This change enables attaching images to the style with batches and avoids massive re-allocations. Thus, it improves UI performance especially at start-up time.
This commit is contained in:
@@ -1099,12 +1099,10 @@ void NativeMapView::removeImage(JNIEnv& env, const jni::String& name) {
|
||||
}
|
||||
|
||||
jni::Local<jni::Object<Bitmap>> NativeMapView::getImage(JNIEnv& env, const jni::String& name) {
|
||||
const mbgl::style::Image *image = map->getStyle().getImage(jni::Make<std::string>(env, name));
|
||||
if (image) {
|
||||
return Bitmap::CreateBitmap(env, image->getImage());
|
||||
} else {
|
||||
return jni::Local<jni::Object<Bitmap>>();
|
||||
if (auto* image = map->getStyle().getImage(jni::Make<std::string>(env, name))) {
|
||||
return Bitmap::CreateBitmap(env, *image);
|
||||
}
|
||||
return jni::Local<jni::Object<Bitmap>>();
|
||||
}
|
||||
|
||||
void NativeMapView::setPrefetchTiles(JNIEnv&, jni::jboolean enable) {
|
||||
|
||||
Reference in New Issue
Block a user