Skip to content

Conversation

mgrudzinska
Copy link
Collaborator

115 lines added
74 lines removed
(in pucker bloat I can remove 14 lines because of this changes

pros:

  • _appendRect fun - I added one extra cubic command to close the shape using cubics. thank that in pucker bloat no extra support for rectangles is necessary - easier to implement

cons:

  • more points - but it is not observed in increased memory usage, so not really a con

@mgrudzinska mgrudzinska self-assigned this Jun 17, 2025
@github-actions github-actions bot added the lottie Lottie animation label Jun 17, 2025
@hermet hermet requested a review from Copilot June 19, 2025 03:08
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors Lottie's path-building logic by switching from line commands to cubic commands, simplifying rectangle drawing and rounding of corners.

  • Updated signature of the line() function in LottieOffsetModifier to remove the degenerated flag.
  • Replaced several direct push of LineTo commands with a new _cubic helper across modifier and builder files.
  • Refactored rectangle and star/polygon path methods in LottieBuilder to use cubic commands, reducing special-case handling.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/loaders/lottie/tvgLottieModifier.h Updated the line() function signature to remove the extra parameter
src/loaders/lottie/tvgLottieModifier.cpp Modified path construction functions (line, corner) to use _cubic helper
src/loaders/lottie/tvgLottieBuilder.cpp Reworked rectangle and star/polygon drawing using cubicTo instead of lineTo
Comments suppressed due to low confidence (3)

src/loaders/lottie/tvgLottieModifier.h:105

  • The removal of the 'bool degenerated' parameter from the line() function signature may affect degenerated case handling; please verify that the new signature preserves the intended behavior.
    void line(RenderPath& out, PathCommand* inCmds, uint32_t inCmdsCnt, Point* inPts, uint32_t& curPt, uint32_t curCmd, State& state, float offset);

src/loaders/lottie/tvgLottieBuilder.cpp:646

  • [nitpick] Replacing a simple lineTo with cubicTo for straight segments may be confusing to future maintainers; consider adding a comment to explain the rationale behind this change.
            shape->cubicTo(SHAPE(shape)->rs.path.pts.last().x, SHAPE(shape)->rs.path.pts.last().y, in.x, in.y, in.x, in.y);

src/loaders/lottie/tvgLottieModifier.cpp:148

  • The removal of the previous conditional check on the command type before computing state.line may alter offset adjustments in cases where the previous command was not a LineTo; please confirm that this change is intentional.
    state.line = _offset(inPts[curPt - 1], inPts[curPt], offset);

@hermet hermet added the refactoring Code refactoring / Exceptional handles label Jun 19, 2025
@hermet hermet force-pushed the main branch 9 times, most recently from 7ceb794 to 43923a5 Compare June 25, 2025 15:59
@hermet hermet force-pushed the main branch 4 times, most recently from 9ddde24 to dac61de Compare August 5, 2025 04:06
@hermet hermet force-pushed the main branch 9 times, most recently from 30c82d7 to 0c3e8ff Compare September 3, 2025 17:59
@hermet hermet force-pushed the main branch 2 times, most recently from 7b0fe6f to 811aac3 Compare September 22, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lottie Lottie animation refactoring Code refactoring / Exceptional handles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants