Skip to content

Commit

Permalink
invalidate parent paint when dash is invalidated
Browse files Browse the repository at this point in the history
when dashes change, the parent stroke wasn't getting neither invalidated nor added dirt to, which would cause the path not to update correctly..
This implementation is copying how trim path invalidates its parent.

Diffs=
b8c47bea69 invalidate parent paint when dash is invalidated (#9029)

Co-authored-by: hernan <[email protected]>
  • Loading branch information
bodymovin and bodymovin committed Feb 13, 2025
1 parent 6c6acda commit 4a67e90
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
670e8ea231777f4f1f63164460521227f16d8068
b8c47bea694e7d34b73470751661f721feeab14f
3 changes: 2 additions & 1 deletion include/rive/shapes/paint/dash_path.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PathDasher

protected:
void invalidateSourcePath();
void invalidateDash();
virtual void invalidateDash();
ShapePaintPath* dash(const RawPath* source,
Dash* offset,
Span<Dash*> dashes);
Expand All @@ -41,6 +41,7 @@ class DashPath : public DashPathBase, public PathDasher, public StrokeEffect
void offsetIsPercentageChanged() override;
void updateEffect(const ShapePaintPath* source) override;
ShapePaintPath* effectPath() override;
void invalidateDash() override;

private:
std::vector<Dash*> m_dashes;
Expand Down
13 changes: 12 additions & 1 deletion src/shapes/paint/dash_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,15 @@ void DashPath::updateEffect(const ShapePaintPath* source)
dash(source->rawPath(), &dashOffset, m_dashes);
}

ShapePaintPath* DashPath::effectPath() { return &m_path; }
ShapePaintPath* DashPath::effectPath() { return &m_path; }

void DashPath::invalidateDash()
{
PathDasher::invalidateDash();
if (parent() != nullptr)
{
auto stroke = parent()->as<Stroke>();
stroke->parent()->addDirt(ComponentDirt::Paint);
stroke->invalidateRendering();
}
}

0 comments on commit 4a67e90

Please sign in to comment.