fix: repair Android Core MIX property bridge
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
OpenAI Codex
2026-09-03 11:07:18 +08:00
parent 5782574c8c
commit 4703d87e23
3 changed files with 26 additions and 2 deletions

View File

@@ -26,6 +26,7 @@
#include <mbgl/util/platform.hpp>
#include <mbgl/util/projection.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/layers/raster_particle_layer.hpp>
#include <mbgl/style/image.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/renderer/query.hpp>
@@ -1112,10 +1113,16 @@ jni::jboolean NativeMapView::setStyleLayerFloatProperty(JNIEnv& env,
const jni::jfloat value) {
auto* layer = map->getStyle().getLayer(jni::Make<std::string>(env, layerId));
if (!layer) return false;
if (const auto error = layer->setProperty(jni::Make<std::string>(env, propertyName), static_cast<double>(value))) {
mbgl::Log::Error(mbgl::Event::JNI, "ParticleGPU: event=STYLE_PROPERTY_SET result=FAILURE " + error->message);
if (jni::Make<std::string>(env, propertyName) != "raster-particle-time-mix") {
mbgl::Log::Error(mbgl::Event::JNI, "ParticleGPU: event=STYLE_PROPERTY_SET result=UNSUPPORTED_PROPERTY");
return false;
}
auto* particleLayer = dynamic_cast<mbgl::style::RasterParticleLayer*>(layer);
if (!particleLayer) {
mbgl::Log::Error(mbgl::Event::JNI, "ParticleGPU: event=STYLE_PROPERTY_SET result=UNSUPPORTED_LAYER");
return false;
}
particleLayer->setTimeMix(value);
mbgl::Log::Info(mbgl::Event::JNI,
"ParticleGPU: event=STYLE_PROPERTY_SET layerId=" + jni::Make<std::string>(env, layerId) +
" property=" + jni::Make<std::string>(env, propertyName) + " value=" + std::to_string(value) +