mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
lottie: code refactoring++
renamed internal variable for improved simplicity. no logical changes.
This commit is contained in:
parent
a67f90951c
commit
2b97cf7a0d
4 changed files with 45 additions and 45 deletions
|
@ -373,7 +373,7 @@ static void _repeat(LottieGroup* parent, Shape* path, RenderContext* ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void _appendRect(Shape* shape, float x, float y, float w, float h, float r, const LottieOffsetModifier* offsetPath, Matrix* transform, bool clockwise)
|
static void _appendRect(Shape* shape, float x, float y, float w, float h, float r, const LottieOffsetModifier* offset, Matrix* transform, bool clockwise)
|
||||||
{
|
{
|
||||||
//sharp rect
|
//sharp rect
|
||||||
if (tvg::zero(r)) {
|
if (tvg::zero(r)) {
|
||||||
|
@ -400,7 +400,7 @@ static void _appendRect(Shape* shape, float x, float y, float w, float h, float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offsetPath) offsetPath->modifyRect(commands, 5, points, 4, SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts);
|
if (offset) offset->modifyRect(commands, 5, points, 4, SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts);
|
||||||
else shape->appendPath(commands, 5, points, 4);
|
else shape->appendPath(commands, 5, points, 4);
|
||||||
//round rect
|
//round rect
|
||||||
} else {
|
} else {
|
||||||
|
@ -453,7 +453,7 @@ static void _appendRect(Shape* shape, float x, float y, float w, float h, float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offsetPath) offsetPath->modifyRect(commands, cmdCnt, points, ptsCnt, SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts);
|
if (offset) offset->modifyRect(commands, cmdCnt, points, ptsCnt, SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts);
|
||||||
else shape->appendPath(commands, cmdCnt, points, ptsCnt);
|
else shape->appendPath(commands, cmdCnt, points, ptsCnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -475,18 +475,18 @@ void LottieBuilder::updateRect(LottieGroup* parent, LottieObject** child, float
|
||||||
if (!ctx->repeaters.empty()) {
|
if (!ctx->repeaters.empty()) {
|
||||||
auto shape = rect->pooling();
|
auto shape = rect->pooling();
|
||||||
shape->reset();
|
shape->reset();
|
||||||
_appendRect(shape, position.x - size.x * 0.5f, position.y - size.y * 0.5f, size.x, size.y, r, ctx->offsetPath, ctx->transform, rect->clockwise);
|
_appendRect(shape, position.x - size.x * 0.5f, position.y - size.y * 0.5f, size.x, size.y, r, ctx->offset, ctx->transform, rect->clockwise);
|
||||||
_repeat(parent, shape, ctx);
|
_repeat(parent, shape, ctx);
|
||||||
} else {
|
} else {
|
||||||
_draw(parent, rect, ctx);
|
_draw(parent, rect, ctx);
|
||||||
_appendRect(ctx->merging, position.x - size.x * 0.5f, position.y - size.y * 0.5f, size.x, size.y, r, ctx->offsetPath, ctx->transform, rect->clockwise);
|
_appendRect(ctx->merging, position.x - size.x * 0.5f, position.y - size.y * 0.5f, size.x, size.y, r, ctx->offset, ctx->transform, rect->clockwise);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void _appendCircle(Shape* shape, float cx, float cy, float rx, float ry, const LottieOffsetModifier* offsetPath, Matrix* transform, bool clockwise)
|
static void _appendCircle(Shape* shape, float cx, float cy, float rx, float ry, const LottieOffsetModifier* offset, Matrix* transform, bool clockwise)
|
||||||
{
|
{
|
||||||
if (offsetPath) offsetPath->modifyEllipse(rx, ry);
|
if (offset) offset->modifyEllipse(rx, ry);
|
||||||
|
|
||||||
if (rx == 0.0f || ry == 0.0f) return;
|
if (rx == 0.0f || ry == 0.0f) return;
|
||||||
|
|
||||||
|
@ -536,11 +536,11 @@ void LottieBuilder::updateEllipse(LottieGroup* parent, LottieObject** child, flo
|
||||||
if (!ctx->repeaters.empty()) {
|
if (!ctx->repeaters.empty()) {
|
||||||
auto shape = ellipse->pooling();
|
auto shape = ellipse->pooling();
|
||||||
shape->reset();
|
shape->reset();
|
||||||
_appendCircle(shape, position.x, position.y, size.x * 0.5f, size.y * 0.5f, ctx->offsetPath, ctx->transform, ellipse->clockwise);
|
_appendCircle(shape, position.x, position.y, size.x * 0.5f, size.y * 0.5f, ctx->offset, ctx->transform, ellipse->clockwise);
|
||||||
_repeat(parent, shape, ctx);
|
_repeat(parent, shape, ctx);
|
||||||
} else {
|
} else {
|
||||||
_draw(parent, ellipse, ctx);
|
_draw(parent, ellipse, ctx);
|
||||||
_appendCircle(ctx->merging, position.x, position.y, size.x * 0.5f, size.y * 0.5f, ctx->offsetPath, ctx->transform, ellipse->clockwise);
|
_appendCircle(ctx->merging, position.x, position.y, size.x * 0.5f, size.y * 0.5f, ctx->offset, ctx->transform, ellipse->clockwise);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,18 +552,18 @@ void LottieBuilder::updatePath(LottieGroup* parent, LottieObject** child, float
|
||||||
if (!ctx->repeaters.empty()) {
|
if (!ctx->repeaters.empty()) {
|
||||||
auto shape = path->pooling();
|
auto shape = path->pooling();
|
||||||
shape->reset();
|
shape->reset();
|
||||||
path->pathset(frameNo, SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, ctx->transform, ctx->roundness, ctx->offsetPath, exps);
|
path->pathset(frameNo, SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, ctx->transform, ctx->roundness, ctx->offset, exps);
|
||||||
_repeat(parent, shape, ctx);
|
_repeat(parent, shape, ctx);
|
||||||
} else {
|
} else {
|
||||||
_draw(parent, path, ctx);
|
_draw(parent, path, ctx);
|
||||||
if (path->pathset(frameNo, SHAPE(ctx->merging)->rs.path.cmds, SHAPE(ctx->merging)->rs.path.pts, ctx->transform, ctx->roundness, ctx->offsetPath, exps)) {
|
if (path->pathset(frameNo, SHAPE(ctx->merging)->rs.path.cmds, SHAPE(ctx->merging)->rs.path.pts, ctx->transform, ctx->roundness, ctx->offset, exps)) {
|
||||||
PAINT(ctx->merging)->update(RenderUpdateFlag::Path);
|
PAINT(ctx->merging)->update(RenderUpdateFlag::Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void _updateStar(TVG_UNUSED LottieGroup* parent, LottiePolyStar* star, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offsetPath, float frameNo, Shape* merging, LottieExpressions* exps)
|
static void _updateStar(TVG_UNUSED LottieGroup* parent, LottiePolyStar* star, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offset, float frameNo, Shape* merging, LottieExpressions* exps)
|
||||||
{
|
{
|
||||||
static constexpr auto POLYSTAR_MAGIC_NUMBER = 0.47829f / 0.28f;
|
static constexpr auto POLYSTAR_MAGIC_NUMBER = 0.47829f / 0.28f;
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ static void _updateStar(TVG_UNUSED LottieGroup* parent, LottiePolyStar* star, Ma
|
||||||
bool roundedCorner = roundness && (tvg::zero(innerRoundness) || tvg::zero(outerRoundness));
|
bool roundedCorner = roundness && (tvg::zero(innerRoundness) || tvg::zero(outerRoundness));
|
||||||
|
|
||||||
Shape* shape;
|
Shape* shape;
|
||||||
if (roundedCorner || offsetPath) {
|
if (roundedCorner || offset) {
|
||||||
shape = star->pooling();
|
shape = star->pooling();
|
||||||
shape->reset();
|
shape->reset();
|
||||||
} else {
|
} else {
|
||||||
|
@ -680,19 +680,19 @@ static void _updateStar(TVG_UNUSED LottieGroup* parent, LottiePolyStar* star, Ma
|
||||||
shape->close();
|
shape->close();
|
||||||
|
|
||||||
if (roundedCorner) {
|
if (roundedCorner) {
|
||||||
if (offsetPath) {
|
if (offset) {
|
||||||
auto intermediate = Shape::gen();
|
auto intermediate = Shape::gen();
|
||||||
roundness->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(intermediate)->rs.path.cmds, SHAPE(intermediate)->rs.path.pts, outerRoundness, hasRoundness);
|
roundness->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(intermediate)->rs.path.cmds, SHAPE(intermediate)->rs.path.pts, outerRoundness, hasRoundness);
|
||||||
offsetPath->modifyPolystar(SHAPE(intermediate)->rs.path.cmds, SHAPE(intermediate)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts);
|
offset->modifyPolystar(SHAPE(intermediate)->rs.path.cmds, SHAPE(intermediate)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts);
|
||||||
delete(intermediate);
|
delete(intermediate);
|
||||||
} else {
|
} else {
|
||||||
roundness->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts, outerRoundness, hasRoundness);
|
roundness->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts, outerRoundness, hasRoundness);
|
||||||
}
|
}
|
||||||
} else if (offsetPath) offsetPath->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts);
|
} else if (offset) offset->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void _updatePolygon(LottieGroup* parent, LottiePolyStar* star, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offsetPath, float frameNo, Shape* merging, LottieExpressions* exps)
|
static void _updatePolygon(LottieGroup* parent, LottiePolyStar* star, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offset, float frameNo, Shape* merging, LottieExpressions* exps)
|
||||||
{
|
{
|
||||||
static constexpr auto POLYGON_MAGIC_NUMBER = 0.25f;
|
static constexpr auto POLYGON_MAGIC_NUMBER = 0.25f;
|
||||||
|
|
||||||
|
@ -711,7 +711,7 @@ static void _updatePolygon(LottieGroup* parent, LottiePolyStar* star, Matrix* tr
|
||||||
angle += anglePerPoint * direction;
|
angle += anglePerPoint * direction;
|
||||||
|
|
||||||
Shape* shape;
|
Shape* shape;
|
||||||
if (roundedCorner || offsetPath) {
|
if (roundedCorner || offset) {
|
||||||
shape = star->pooling();
|
shape = star->pooling();
|
||||||
shape->reset();
|
shape->reset();
|
||||||
} else {
|
} else {
|
||||||
|
@ -767,15 +767,15 @@ static void _updatePolygon(LottieGroup* parent, LottiePolyStar* star, Matrix* tr
|
||||||
shape->close();
|
shape->close();
|
||||||
|
|
||||||
if (roundedCorner) {
|
if (roundedCorner) {
|
||||||
if (offsetPath) {
|
if (offset) {
|
||||||
auto intermediate = Shape::gen();
|
auto intermediate = Shape::gen();
|
||||||
roundness->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(intermediate)->rs.path.cmds, SHAPE(intermediate)->rs.path.pts, 0.0f, false);
|
roundness->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(intermediate)->rs.path.cmds, SHAPE(intermediate)->rs.path.pts, 0.0f, false);
|
||||||
offsetPath->modifyPolystar(SHAPE(intermediate)->rs.path.cmds, SHAPE(intermediate)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts);
|
offset->modifyPolystar(SHAPE(intermediate)->rs.path.cmds, SHAPE(intermediate)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts);
|
||||||
delete(intermediate);
|
delete(intermediate);
|
||||||
} else {
|
} else {
|
||||||
roundness->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts, 0.0f, false);
|
roundness->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts, 0.0f, false);
|
||||||
}
|
}
|
||||||
} else if (offsetPath) offsetPath->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts);
|
} else if (offset) offset->modifyPolystar(SHAPE(shape)->rs.path.cmds, SHAPE(shape)->rs.path.pts, SHAPE(merging)->rs.path.cmds, SHAPE(merging)->rs.path.pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -796,13 +796,13 @@ void LottieBuilder::updatePolystar(LottieGroup* parent, LottieObject** child, fl
|
||||||
if (!ctx->repeaters.empty()) {
|
if (!ctx->repeaters.empty()) {
|
||||||
auto shape = star->pooling();
|
auto shape = star->pooling();
|
||||||
shape->reset();
|
shape->reset();
|
||||||
if (star->type == LottiePolyStar::Star) _updateStar(parent, star, identity ? nullptr : &matrix, ctx->roundness, ctx->offsetPath, frameNo, shape, exps);
|
if (star->type == LottiePolyStar::Star) _updateStar(parent, star, identity ? nullptr : &matrix, ctx->roundness, ctx->offset, frameNo, shape, exps);
|
||||||
else _updatePolygon(parent, star, identity ? nullptr : &matrix, ctx->roundness, ctx->offsetPath, frameNo, shape, exps);
|
else _updatePolygon(parent, star, identity ? nullptr : &matrix, ctx->roundness, ctx->offset, frameNo, shape, exps);
|
||||||
_repeat(parent, shape, ctx);
|
_repeat(parent, shape, ctx);
|
||||||
} else {
|
} else {
|
||||||
_draw(parent, star, ctx);
|
_draw(parent, star, ctx);
|
||||||
if (star->type == LottiePolyStar::Star) _updateStar(parent, star, identity ? nullptr : &matrix, ctx->roundness, ctx->offsetPath, frameNo, ctx->merging, exps);
|
if (star->type == LottiePolyStar::Star) _updateStar(parent, star, identity ? nullptr : &matrix, ctx->roundness, ctx->offset, frameNo, ctx->merging, exps);
|
||||||
else _updatePolygon(parent, star, identity ? nullptr : &matrix, ctx->roundness, ctx->offsetPath, frameNo, ctx->merging, exps);
|
else _updatePolygon(parent, star, identity ? nullptr : &matrix, ctx->roundness, ctx->offset, frameNo, ctx->merging, exps);
|
||||||
PAINT(ctx->merging)->update(RenderUpdateFlag::Path);
|
PAINT(ctx->merging)->update(RenderUpdateFlag::Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -821,8 +821,8 @@ void LottieBuilder::updateRoundedCorner(TVG_UNUSED LottieGroup* parent, LottieOb
|
||||||
|
|
||||||
void LottieBuilder::updateOffsetPath(TVG_UNUSED LottieGroup* parent, LottieObject** child, float frameNo, TVG_UNUSED Inlist<RenderContext>& contexts, RenderContext* ctx)
|
void LottieBuilder::updateOffsetPath(TVG_UNUSED LottieGroup* parent, LottieObject** child, float frameNo, TVG_UNUSED Inlist<RenderContext>& contexts, RenderContext* ctx)
|
||||||
{
|
{
|
||||||
auto offsetPath = static_cast<LottieOffsetPath*>(*child);
|
auto offset = static_cast<LottieOffsetPath*>(*child);
|
||||||
if (!ctx->offsetPath) ctx->offsetPath = new LottieOffsetModifier(offsetPath->offset(frameNo, exps), offsetPath->miterLimit(frameNo, exps), offsetPath->join);
|
if (!ctx->offset) ctx->offset = new LottieOffsetModifier(offset->offset(frameNo, exps), offset->miterLimit(frameNo, exps), offset->join);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct RenderContext
|
||||||
Array<RenderRepeater> repeaters;
|
Array<RenderRepeater> repeaters;
|
||||||
Matrix* transform = nullptr;
|
Matrix* transform = nullptr;
|
||||||
LottieRoundnessModifier* roundness = nullptr;
|
LottieRoundnessModifier* roundness = nullptr;
|
||||||
LottieOffsetModifier* offsetPath = nullptr;
|
LottieOffsetModifier* offset = nullptr;
|
||||||
bool fragmenting = false; //render context has been fragmented by filling
|
bool fragmenting = false; //render context has been fragmented by filling
|
||||||
bool reqFragment = false; //requirement to fragment the render context
|
bool reqFragment = false; //requirement to fragment the render context
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ struct RenderContext
|
||||||
propagator->unref(false);
|
propagator->unref(false);
|
||||||
free(transform);
|
free(transform);
|
||||||
delete(roundness);
|
delete(roundness);
|
||||||
delete(offsetPath);
|
delete(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderContext(const RenderContext& rhs, Shape* propagator, bool mergeable = false)
|
RenderContext(const RenderContext& rhs, Shape* propagator, bool mergeable = false)
|
||||||
|
@ -80,9 +80,9 @@ struct RenderContext
|
||||||
if (mergeable) merging = rhs.merging;
|
if (mergeable) merging = rhs.merging;
|
||||||
propagator->ref();
|
propagator->ref();
|
||||||
this->propagator = propagator;
|
this->propagator = propagator;
|
||||||
this->repeaters = rhs.repeaters;
|
repeaters = rhs.repeaters;
|
||||||
if (rhs.roundness) this->roundness = new LottieRoundnessModifier(rhs.roundness->r);
|
if (rhs.roundness) roundness = new LottieRoundnessModifier(rhs.roundness->r);
|
||||||
if (rhs.offsetPath) this->offsetPath = new LottieOffsetModifier(rhs.offsetPath->offset, rhs.offsetPath->miterLimit, rhs.offsetPath->join);
|
if (rhs.offset) offset = new LottieOffsetModifier(rhs.offset->offset, rhs.offset->miterLimit, rhs.offset->join);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -112,13 +112,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Property>
|
template<typename Property>
|
||||||
bool result(float frameNo, Array<PathCommand>& cmds, Array<Point>& pts, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offsetPath, LottieExpression* exp)
|
bool result(float frameNo, Array<PathCommand>& cmds, Array<Point>& pts, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offset, LottieExpression* exp)
|
||||||
{
|
{
|
||||||
auto bm_rt = evaluate(frameNo, exp);
|
auto bm_rt = evaluate(frameNo, exp);
|
||||||
if (jerry_value_is_undefined(bm_rt)) return false;
|
if (jerry_value_is_undefined(bm_rt)) return false;
|
||||||
|
|
||||||
if (auto pathset = static_cast<Property*>(jerry_object_get_native_ptr(bm_rt, nullptr))) {
|
if (auto pathset = static_cast<Property*>(jerry_object_get_native_ptr(bm_rt, nullptr))) {
|
||||||
(*pathset)(frameNo, cmds, pts, transform, roundness, offsetPath);
|
(*pathset)(frameNo, cmds, pts, transform, roundness, offset);
|
||||||
}
|
}
|
||||||
jerry_value_free(bm_rt);
|
jerry_value_free(bm_rt);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -448,7 +448,7 @@ struct LottiePathSet : LottieProperty
|
||||||
return (*frames)[frames->count];
|
return (*frames)[frames->count];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator()(float frameNo, Array<PathCommand>& cmds, Array<Point>& pts, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offsetPath)
|
bool operator()(float frameNo, Array<PathCommand>& cmds, Array<Point>& pts, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offset)
|
||||||
{
|
{
|
||||||
PathSet* path = nullptr;
|
PathSet* path = nullptr;
|
||||||
LottieScalarFrame<PathSet>* frame = nullptr;
|
LottieScalarFrame<PathSet>* frame = nullptr;
|
||||||
|
@ -474,15 +474,15 @@ struct LottiePathSet : LottieProperty
|
||||||
|
|
||||||
if (!interpolate) {
|
if (!interpolate) {
|
||||||
if (roundness) {
|
if (roundness) {
|
||||||
if (offsetPath) {
|
if (offset) {
|
||||||
Array<PathCommand> cmds1(path->cmdsCnt);
|
Array<PathCommand> cmds1(path->cmdsCnt);
|
||||||
Array<Point> pts1(path->ptsCnt);
|
Array<Point> pts1(path->ptsCnt);
|
||||||
roundness->modifyPath(path->cmds, path->cmdsCnt, path->pts, path->ptsCnt, cmds1, pts1, transform);
|
roundness->modifyPath(path->cmds, path->cmdsCnt, path->pts, path->ptsCnt, cmds1, pts1, transform);
|
||||||
return offsetPath->modifyPath(cmds1.data, cmds1.count, pts1.data, pts1.count, cmds, pts);
|
return offset->modifyPath(cmds1.data, cmds1.count, pts1.data, pts1.count, cmds, pts);
|
||||||
}
|
}
|
||||||
return roundness->modifyPath(path->cmds, path->cmdsCnt, path->pts, path->ptsCnt, cmds, pts, transform);
|
return roundness->modifyPath(path->cmds, path->cmdsCnt, path->pts, path->ptsCnt, cmds, pts, transform);
|
||||||
}
|
}
|
||||||
if (offsetPath) return offsetPath->modifyPath(path->cmds, path->cmdsCnt, path->pts, path->ptsCnt, cmds, pts);
|
if (offset) return offset->modifyPath(path->cmds, path->cmdsCnt, path->pts, path->ptsCnt, cmds, pts);
|
||||||
|
|
||||||
_copy(path, cmds);
|
_copy(path, cmds);
|
||||||
_copy(path, pts, transform);
|
_copy(path, pts, transform);
|
||||||
|
@ -492,7 +492,7 @@ struct LottiePathSet : LottieProperty
|
||||||
auto s = frame->value.pts;
|
auto s = frame->value.pts;
|
||||||
auto e = (frame + 1)->value.pts;
|
auto e = (frame + 1)->value.pts;
|
||||||
|
|
||||||
if (!roundness && !offsetPath) {
|
if (!roundness && !offset) {
|
||||||
for (auto i = 0; i < frame->value.ptsCnt; ++i, ++s, ++e) {
|
for (auto i = 0; i < frame->value.ptsCnt; ++i, ++s, ++e) {
|
||||||
auto pt = lerp(*s, *e, t);
|
auto pt = lerp(*s, *e, t);
|
||||||
if (transform) pt *= *transform;
|
if (transform) pt *= *transform;
|
||||||
|
@ -510,13 +510,13 @@ struct LottiePathSet : LottieProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roundness) {
|
if (roundness) {
|
||||||
if (offsetPath) {
|
if (offset) {
|
||||||
Array<PathCommand> cmds1;
|
Array<PathCommand> cmds1;
|
||||||
Array<Point> pts1;
|
Array<Point> pts1;
|
||||||
roundness->modifyPath(frame->value.cmds, frame->value.cmdsCnt, interpPts, frame->value.ptsCnt, cmds1, pts1, nullptr);
|
roundness->modifyPath(frame->value.cmds, frame->value.cmdsCnt, interpPts, frame->value.ptsCnt, cmds1, pts1, nullptr);
|
||||||
offsetPath->modifyPath(cmds1.data, cmds1.count, pts1.data, pts1.count, cmds, pts);
|
offset->modifyPath(cmds1.data, cmds1.count, pts1.data, pts1.count, cmds, pts);
|
||||||
} else roundness->modifyPath(frame->value.cmds, frame->value.cmdsCnt, interpPts, frame->value.ptsCnt, cmds, pts, nullptr);
|
} else roundness->modifyPath(frame->value.cmds, frame->value.cmdsCnt, interpPts, frame->value.ptsCnt, cmds, pts, nullptr);
|
||||||
} else if (offsetPath) offsetPath->modifyPath(frame->value.cmds, frame->value.cmdsCnt, interpPts, frame->value.ptsCnt, cmds, pts);
|
} else if (offset) offset->modifyPath(frame->value.cmds, frame->value.cmdsCnt, interpPts, frame->value.ptsCnt, cmds, pts);
|
||||||
|
|
||||||
free(interpPts);
|
free(interpPts);
|
||||||
|
|
||||||
|
@ -524,13 +524,13 @@ struct LottiePathSet : LottieProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool operator()(float frameNo, Array<PathCommand>& cmds, Array<Point>& pts, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offsetPath, LottieExpressions* exps)
|
bool operator()(float frameNo, Array<PathCommand>& cmds, Array<Point>& pts, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offset, LottieExpressions* exps)
|
||||||
{
|
{
|
||||||
if (exps && exp) {
|
if (exps && exp) {
|
||||||
frameNo = _loop(frames, frameNo, exp);
|
frameNo = _loop(frames, frameNo, exp);
|
||||||
if (exps->result<LottiePathSet>(frameNo, cmds, pts, transform, roundness, offsetPath, exp)) return true;
|
if (exps->result<LottiePathSet>(frameNo, cmds, pts, transform, roundness, offset, exp)) return true;
|
||||||
}
|
}
|
||||||
return operator()(frameNo, cmds, pts, transform, roundness, offsetPath);
|
return operator()(frameNo, cmds, pts, transform, roundness, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepare() {}
|
void prepare() {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue