diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2010-09-27 11:02:47 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2010-09-27 12:04:35 (GMT) |
commit | d60dc7cba21794866c9382f83080fab1a129eb08 (patch) | |
tree | cb427a36cf9946e2f486d40be432f351fc9f9347 /src/gui/painting/qstroker.cpp | |
parent | 5ff714badf06f492c3f6f8282b64181cc93faadb (diff) | |
download | Qt-d60dc7cba21794866c9382f83080fab1a129eb08.zip Qt-d60dc7cba21794866c9382f83080fab1a129eb08.tar.gz Qt-d60dc7cba21794866c9382f83080fab1a129eb08.tar.bz2 |
Fixed performance regression in curve stroking.
Change c46688b8a88da made us use m_curve_threshold for both
QBezier::shifted and QBezier::toPolygon, and adjusted the threshold
dynamically based on the painter scale. Since the threshold in shifted
was already relative to the pen width, it is independent from the
painter scale. Instead, we need to set a separate threshold for dashing.
Also, in several places we were calling setCurveThresholdForTransform
with the painter matrix even though we were transforming the points into
device coordinate space before stroking.
Task-number: QTBUG-13894
Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src/gui/painting/qstroker.cpp')
-rw-r--r-- | src/gui/painting/qstroker.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index 9cff339..9decf41 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -190,6 +190,7 @@ static inline qreal adapted_angle_on_x(const QLineF &line) QStrokerOps::QStrokerOps() : m_elements(0) , m_curveThreshold(qt_real_to_fixed(0.25)) + , m_dashThreshold(qt_real_to_fixed(0.25)) , m_customData(0) , m_moveTo(0) , m_lineTo(0) @@ -243,7 +244,7 @@ void QStrokerOps::strokePath(const QPainterPath &path, void *customData, const Q if (path.isEmpty()) return; - setCurveThresholdFromTransform(matrix); + setCurveThresholdFromTransform(QTransform()); begin(customData); int count = path.elementCount(); if (matrix.isIdentity()) { @@ -315,7 +316,7 @@ void QStrokerOps::strokePolygon(const QPointF *points, int pointCount, bool impl if (!pointCount) return; - setCurveThresholdFromTransform(matrix); + setCurveThresholdFromTransform(QTransform()); begin(data); if (matrix.isIdentity()) { moveTo(qt_real_to_fixed(points[0].x()), qt_real_to_fixed(points[0].y())); @@ -356,7 +357,7 @@ void QStrokerOps::strokeEllipse(const QRectF &rect, void *data, const QTransform } } - setCurveThresholdFromTransform(matrix); + setCurveThresholdFromTransform(QTransform()); begin(data); moveTo(qt_real_to_fixed(start.x()), qt_real_to_fixed(start.y())); for (int i=0; i<12; i+=3) { @@ -1142,7 +1143,7 @@ void QDashStroker::processCurrentSubpath() QPainterPath dashPath; - QSubpathFlatIterator it(&m_elements, m_curveThreshold); + QSubpathFlatIterator it(&m_elements, m_dashThreshold); qfixed2d prev = it.next(); bool clipping = !m_clip_rect.isEmpty(); |