mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
api: revise the api for v1.0
API Modification: - Matrix Paint::transform() -> Matrix& Paint::transform() issue: https://github.com/thorvg/thorvg/issues/1372
This commit is contained in:
parent
8ee5f5c544
commit
6a45e6e494
3 changed files with 7 additions and 9 deletions
|
@ -358,7 +358,7 @@ public:
|
|||
*
|
||||
* @since 0.4
|
||||
*/
|
||||
Matrix transform() noexcept;
|
||||
Matrix& transform() noexcept;
|
||||
|
||||
/**
|
||||
* @brief Sets the opacity of the object.
|
||||
|
|
|
@ -188,7 +188,7 @@ void LottieBuilder::updateTransform(LottieGroup* parent, LottieObject** child, f
|
|||
Matrix matrix;
|
||||
if (!_updateTransform(transform, frameNo, false, matrix, opacity, exps)) return;
|
||||
|
||||
ctx->propagator->transform(PP(ctx->propagator)->transform() * matrix);
|
||||
ctx->propagator->transform(ctx->propagator->transform() * matrix);
|
||||
ctx->propagator->opacity(MULTIPLY(opacity, PP(ctx->propagator)->opacity));
|
||||
|
||||
//FIXME: preserve the stroke width. too workaround, need a better design.
|
||||
|
@ -356,7 +356,7 @@ static void _repeat(LottieGroup* parent, Shape* path, RenderContext* ctx)
|
|||
|
||||
Matrix inv;
|
||||
inverse(&repeater->transform, &inv);
|
||||
shape->transform(m * (inv * PP(shape)->transform()));
|
||||
shape->transform(m * (inv * shape->transform()));
|
||||
shapes.push(shape);
|
||||
}
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ void LottieBuilder::updateRepeater(TVG_UNUSED LottieGroup* parent, LottieObject*
|
|||
|
||||
RenderRepeater r;
|
||||
r.cnt = static_cast<int>(repeater->copies(frameNo, exps));
|
||||
r.transform = PP(ctx->propagator)->transform();
|
||||
r.transform = ctx->propagator->transform();
|
||||
r.offset = repeater->offset(frameNo, exps);
|
||||
r.position = repeater->position(frameNo, exps);
|
||||
r.anchor = repeater->anchor(frameNo, exps);
|
||||
|
@ -1072,7 +1072,7 @@ void LottieBuilder::updateText(LottieLayer* layer, float frameNo)
|
|||
else if ((*s)->based == LottieTextRange::Based::Lines) basedIdx = line;
|
||||
|
||||
if (basedIdx < start || basedIdx >= end) continue;
|
||||
auto matrix = shape->transform();
|
||||
auto& matrix = shape->transform();
|
||||
|
||||
shape->opacity((*s)->style.opacity(frameNo));
|
||||
|
||||
|
@ -1087,8 +1087,6 @@ void LottieBuilder::updateText(LottieLayer* layer, float frameNo)
|
|||
auto position = (*s)->style.position(frameNo);
|
||||
translate(&matrix, position.x, position.y);
|
||||
|
||||
shape->transform(matrix);
|
||||
|
||||
if (doc.stroke.render) {
|
||||
auto strokeColor = (*s)->style.strokeColor(frameNo);
|
||||
shape->strokeWidth((*s)->style.strokeWidth(frameNo) / scale);
|
||||
|
|
|
@ -86,7 +86,7 @@ static Result _compFastTrack(RenderMethod* renderer, Paint* cmpTarget, const Mat
|
|||
if (ptsCnt == 0) return Result::InvalidArguments;
|
||||
if (ptsCnt != 4) return Result::InsufficientCondition;
|
||||
|
||||
auto& rm = P(cmpTarget)->transform();
|
||||
auto& rm = cmpTarget->transform();
|
||||
|
||||
//No rotation and no skewing, still can try out clipping the rect region.
|
||||
auto tryClip = false;
|
||||
|
@ -423,7 +423,7 @@ Result Paint::transform(const Matrix& m) noexcept
|
|||
}
|
||||
|
||||
|
||||
Matrix Paint::transform() noexcept
|
||||
Matrix& Paint::transform() noexcept
|
||||
{
|
||||
return pImpl->transform();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue