feat: add Android particle capacity baseline
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <list>
|
||||
#include <tuple>
|
||||
@@ -1113,7 +1115,8 @@ 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 (jni::Make<std::string>(env, propertyName) != "raster-particle-time-mix") {
|
||||
const auto property = jni::Make<std::string>(env, propertyName);
|
||||
if (property != "raster-particle-time-mix" && property != "raster-particle-particle-count") {
|
||||
mbgl::Log::Error(mbgl::Event::JNI, "ParticleGPU: event=STYLE_PROPERTY_SET result=UNSUPPORTED_PROPERTY");
|
||||
return false;
|
||||
}
|
||||
@@ -1122,11 +1125,23 @@ jni::jboolean NativeMapView::setStyleLayerFloatProperty(JNIEnv& env,
|
||||
mbgl::Log::Error(mbgl::Event::JNI, "ParticleGPU: event=STYLE_PROPERTY_SET result=UNSUPPORTED_LAYER");
|
||||
return false;
|
||||
}
|
||||
particleLayer->setTimeMix(value);
|
||||
if (property == "raster-particle-time-mix") {
|
||||
particleLayer->setTimeMix(value);
|
||||
} else {
|
||||
if (!std::isfinite(value) || value < 0.0f || std::floor(value) != value) {
|
||||
mbgl::Log::Error(mbgl::Event::JNI, "ParticleGPU: event=STYLE_PROPERTY_SET result=INVALID_PARTICLE_COUNT");
|
||||
return false;
|
||||
}
|
||||
const auto requestedCount = static_cast<uint32_t>(value);
|
||||
particleLayer->setParticleCount(requestedCount);
|
||||
if (particleLayer->getParticleCount() != requestedCount) {
|
||||
mbgl::Log::Error(mbgl::Event::JNI, "ParticleGPU: event=STYLE_PROPERTY_SET result=INVALID_PARTICLE_COUNT");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
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) +
|
||||
" result=SUCCESS");
|
||||
" property=" + property + " value=" + std::to_string(value) + " result=SUCCESS");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user