mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-09 06:04:03 +00:00
lottie: Fixed trimpath to support simultaneous trimpath
The previous version omitted support for simultaneous trimpath, but it is now working as intended.
This commit is contained in:
parent
625c2405fc
commit
3123e184c8
2 changed files with 5 additions and 6 deletions
|
@ -58,6 +58,7 @@ struct RenderContext
|
||||||
float roundness = 0.0f;
|
float roundness = 0.0f;
|
||||||
bool stroking = false; //context has been separated by the stroking
|
bool stroking = false; //context has been separated by the stroking
|
||||||
bool reqFragment = false; //requirment to fragment the render context
|
bool reqFragment = false; //requirment to fragment the render context
|
||||||
|
bool allowMerging = true; //individual trimpath doesn't allow merging shapes
|
||||||
|
|
||||||
RenderContext()
|
RenderContext()
|
||||||
{
|
{
|
||||||
|
@ -304,7 +305,7 @@ static Shape* _updateFill(LottieGradientFill* fill, int32_t frameNo, RenderConte
|
||||||
|
|
||||||
static Shape* _draw(LottieGroup* parent, int32_t frameNo, RenderContext& ctx)
|
static Shape* _draw(LottieGroup* parent, int32_t frameNo, RenderContext& ctx)
|
||||||
{
|
{
|
||||||
if (ctx.merging) return ctx.merging;
|
if (ctx.allowMerging && ctx.merging) return ctx.merging;
|
||||||
|
|
||||||
auto shape = cast<Shape>(ctx.propagator->duplicate());
|
auto shape = cast<Shape>(ctx.propagator->duplicate());
|
||||||
ctx.merging = shape.get();
|
ctx.merging = shape.get();
|
||||||
|
@ -702,11 +703,9 @@ static void _updateTrimpath(LottieTrimpath* trimpath, int32_t frameNo, RenderCon
|
||||||
end = (length * end) + pbegin;
|
end = (length * end) + pbegin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trimpath->type == LottieTrimpath::Individual) {
|
|
||||||
TVGERR("LOTTIE", "TODO: Individual Trimpath");
|
|
||||||
}
|
|
||||||
|
|
||||||
P(ctx.propagator)->strokeTrim(begin, end);
|
P(ctx.propagator)->strokeTrim(begin, end);
|
||||||
|
|
||||||
|
if (trimpath->type == LottieTrimpath::Individual) ctx.allowMerging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -240,7 +240,7 @@ struct LottieObject
|
||||||
|
|
||||||
struct LottieTrimpath : LottieObject
|
struct LottieTrimpath : LottieObject
|
||||||
{
|
{
|
||||||
enum Type : uint8_t { Simultaneous = 1, Individual = 2 };
|
enum Type : uint8_t { Individual = 1, Simultaneous = 2 };
|
||||||
|
|
||||||
void prepare()
|
void prepare()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue