summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainterpath.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qpainterpath.cpp')
-rw-r--r--src/gui/painting/qpainterpath.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 69e189c..c40bcee 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -688,6 +688,8 @@ void QPainterPath::lineTo(const QPointF &p)
return;
Element elm = { p.x(), p.y(), LineToElement };
d->elements.append(elm);
+
+ d->convex = d->elements.size() == 3 || (d->elements.size() == 4 && d->isClosed());
}
/*!
@@ -960,6 +962,8 @@ void QPainterPath::addRect(const QRectF &r)
ensureData();
detach();
+ bool first = d_func()->elements.size() < 2;
+
d_func()->elements.reserve(d_func()->elements.size() + 5);
moveTo(r.x(), r.y());
@@ -970,6 +974,7 @@ void QPainterPath::addRect(const QRectF &r)
d_func()->elements << l1 << l2 << l3 << l4;
d_func()->require_moveTo = true;
+ d_func()->convex = first;
}
/*!
@@ -1039,6 +1044,7 @@ void QPainterPath::addEllipse(const QRectF &boundingRect)
detach();
Q_D(QPainterPath);
+ bool first = d_func()->elements.size() < 2;
d->elements.reserve(d->elements.size() + 13);
QPointF pts[12];
@@ -1051,6 +1057,8 @@ void QPainterPath::addEllipse(const QRectF &boundingRect)
cubicTo(pts[6], pts[7], pts[8]); // 180 -> 90
cubicTo(pts[9], pts[10], pts[11]); // 90 - >0
d_func()->require_moveTo = true;
+
+ d_func()->convex = first;
}
/*!
@@ -3027,6 +3035,8 @@ void QPainterPath::addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadi
ensureData();
detach();
+ bool first = d_func()->elements.size() < 2;
+
arcMoveTo(x, y, rxx2, ryy2, 90);
arcTo(x, y, rxx2, ryy2, 90, 90);
arcTo(x, y+h-ryy2, rxx2, ryy2, 2*90, 90);
@@ -3035,6 +3045,7 @@ void QPainterPath::addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadi
closeSubpath();
d_func()->require_moveTo = true;
+ d_func()->convex = first;
}
/*!
@@ -3081,6 +3092,8 @@ void QPainterPath::addRoundRect(const QRectF &r, int xRnd, int yRnd)
ensureData();
detach();
+ bool first = d_func()->elements.size() < 2;
+
arcMoveTo(x, y, rxx2, ryy2, 90);
arcTo(x, y, rxx2, ryy2, 90, 90);
arcTo(x, y+h-ryy2, rxx2, ryy2, 2*90, 90);
@@ -3089,6 +3102,7 @@ void QPainterPath::addRoundRect(const QRectF &r, int xRnd, int yRnd)
closeSubpath();
d_func()->require_moveTo = true;
+ d_func()->convex = first;
}
/*!
@@ -3269,6 +3283,7 @@ void QPainterPath::setDirty(bool dirty)
d_func()->dirtyControlBounds = dirty;
delete d_func()->pathConverter;
d_func()->pathConverter = 0;
+ d_func()->convex = false;
}
void QPainterPath::computeBoundingRect() const