Skip to content

Commit

Permalink
fix dash with world path
Browse files Browse the repository at this point in the history
fix for dashes with world paths being transformed as local paths

Diffs=
223ed4c89a fix dash with world path (#9041)

Co-authored-by: hernan <[email protected]>
  • Loading branch information
bodymovin and bodymovin committed Feb 14, 2025
1 parent 7f971fb commit da9b173
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9058a3fdad2444ca9eab3ef06bc49376eadba9de
223ed4c89a78c24d1a6152551041b30193f1427f
3 changes: 3 additions & 0 deletions include/rive/shapes/paint/dash_path.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class PathDasher
ShapePaintPath* dash(const RawPath* source,
Dash* offset,
Span<Dash*> dashes);
ShapePaintPath* applyDash(const RawPath* source,
Dash* offset,
Span<Dash*> dashes);

protected:
ShapePaintPath m_path;
Expand Down
5 changes: 5 additions & 0 deletions include/rive/shapes/shape_paint_path.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ class ShapePaintPath
m_fillRule = fillRule;
rewind();
}
void rewind(bool isLocal)
{
m_isLocal = isLocal;
rewind();
}
void addPath(const RawPath& rawPath, const Mat2D* transform = nullptr);
void addPathBackwards(const RawPath& rawPath,
const Mat2D* transform = nullptr);
Expand Down
15 changes: 14 additions & 1 deletion src/shapes/paint/dash_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ ShapePaintPath* PathDasher::dash(const RawPath* source,
}

m_path.rewind();
return applyDash(source, offset, dashes);
}
ShapePaintPath* PathDasher::applyDash(const RawPath* source,
Dash* offset,
Span<Dash*> dashes)
{
if (m_contours.empty())
{
// 0.5f / 8.0f is a value that seems to look good on dashes with small
Expand Down Expand Up @@ -144,8 +150,15 @@ void DashPath::offsetIsPercentageChanged() { invalidateDash(); }

void DashPath::updateEffect(const ShapePaintPath* source)
{

if (m_path.hasRenderPath())
{
return;
}
m_path.rewind(source->isLocal());

Dash dashOffset(offset(), offsetIsPercentage());
dash(source->rawPath(), &dashOffset, m_dashes);
applyDash(source->rawPath(), &dashOffset, m_dashes);
}

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

0 comments on commit da9b173

Please sign in to comment.