Skip to content

Commit

Permalink
Correct clipping issue. clipPath must never be empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
jebos committed Nov 1, 2023
1 parent 3a821e5 commit 743bba5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/RiveQtQuickItem/riveqtpath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,14 @@ QVector<QVector<QVector2D>> RiveQtPath::toVertices()
void RiveQtPath::intersectWith(const QPainterPath &other)
{
if (!m_qPainterPath.isEmpty()) {
m_qPainterPath = m_qPainterPath.intersected(other);
m_pathSegmentDataDirty = true;
m_pathSegmentOutlineDataDirty = true;
if (m_qPainterPath.intersects(other)) {
QPainterPath tempQPainterPath = m_qPainterPath.intersected(other);
if (!tempQPainterPath.isEmpty()) {
m_qPainterPath = tempQPainterPath;
m_pathSegmentDataDirty = true;
m_pathSegmentOutlineDataDirty = true;
}
}
}
}

Expand Down Expand Up @@ -188,7 +193,6 @@ std::optional<QVector2D> calculateIntersection(const QVector2D &p1, const QVecto
return QVector2D(intersectX, intersectY);
}


QPointF RiveQtPath::cubicBezier(const QPointF &startPoint, const QPointF &controlPoint1, const QPointF &controlPoint2,
const QPointF &endPoint, qreal t)
{
Expand Down

0 comments on commit 743bba5

Please sign in to comment.