diff --git a/src/loaders/lottie/tvgLottieModel.h b/src/loaders/lottie/tvgLottieModel.h index feb32e78..1b194fb9 100644 --- a/src/loaders/lottie/tvgLottieModel.h +++ b/src/loaders/lottie/tvgLottieModel.h @@ -455,17 +455,20 @@ struct LottieGradient : LottieObject color.input->reset(); delete(color.input); + colorStops.populated = true; return output.count; } bool prepare() { - if (colorStops.frames) { - for (auto v = colorStops.frames->begin(); v < colorStops.frames->end(); ++v) { - colorStops.count = populate(v->value); + if (!colorStops.populated) { + if (colorStops.frames) { + for (auto v = colorStops.frames->begin(); v < colorStops.frames->end(); ++v) { + colorStops.count = populate(v->value); + } + } else { + colorStops.count = populate(colorStops.value); } - } else { - colorStops.count = populate(colorStops.value); } if (start.frames || end.frames || height.frames || angle.frames || opacity.frames || colorStops.frames) return true; return false; diff --git a/src/loaders/lottie/tvgLottieProperty.h b/src/loaders/lottie/tvgLottieProperty.h index 5b969bfa..7178277a 100644 --- a/src/loaders/lottie/tvgLottieProperty.h +++ b/src/loaders/lottie/tvgLottieProperty.h @@ -361,6 +361,7 @@ struct LottieColorStop : LottieProperty Array>* frames = nullptr; ColorStop value; uint16_t count = 0; //colorstop count + bool populated = false; ~LottieColorStop() { @@ -462,6 +463,7 @@ struct LottieColorStop : LottieProperty value = other.value; const_cast(other).value.data = nullptr; } + populated = other.populated; count = other.count; return *this; }