diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2010-05-11 10:46:46 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2010-05-12 12:59:34 (GMT) |
commit | c46688b8a88da02028405604ab633b27d3fefa68 (patch) | |
tree | ca595b07c4cdf82767c10a52bbeaba75490f42f9 /src/gui/painting/qstroker_p.h | |
parent | 9b6041bf62cfd2b0be62134ff6ee0fd488ce5921 (diff) | |
download | Qt-c46688b8a88da02028405604ab633b27d3fefa68.zip Qt-c46688b8a88da02028405604ab633b27d3fefa68.tar.gz Qt-c46688b8a88da02028405604ab633b27d3fefa68.tar.bz2 |
Made curve tesselation be dynamically adjusted based on transform.
This lets us avoid having to use a very low curve threshold value for
all scales, and thus avoids the performance regression from change
c41dbbb5e6495e26cd32.
Task-number: QTBUG-9218
Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src/gui/painting/qstroker_p.h')
-rw-r--r-- | src/gui/painting/qstroker_p.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index 3e622a8..0f133ef 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -124,6 +124,9 @@ typedef void (*qStrokerCubicToHook)(qfixed c1x, qfixed c1y, qfixed ex, qfixed ey, void *data); +// qtransform.cpp +extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); + class Q_GUI_EXPORT QStrokerOps { public: @@ -161,6 +164,16 @@ public: QRectF clipRect() const { return m_clip_rect; } void setClipRect(const QRectF &clip) { m_clip_rect = clip; } + void setCurveThresholdFromTransform(const QTransform &transform) + { + qreal scale; + qt_scaleForTransform(transform, &scale); + setCurveThreshold(scale == 0 ? qreal(0.5) : (qreal(0.5) / scale)); + } + + void setCurveThreshold(qfixed threshold) { m_curveThreshold = threshold; } + qfixed curveThreshold() const { return m_curveThreshold; } + protected: inline void emitMoveTo(qfixed x, qfixed y); inline void emitLineTo(qfixed x, qfixed y); @@ -170,6 +183,7 @@ protected: QDataBuffer<Element> m_elements; QRectF m_clip_rect; + qfixed m_curveThreshold; void *m_customData; qStrokerMoveToHook m_moveTo; @@ -208,9 +222,6 @@ public: void setMiterLimit(qfixed length) { m_miterLimit = length; } qfixed miterLimit() const { return m_miterLimit; } - void setCurveThreshold(qfixed threshold) { m_curveThreshold = threshold; } - qfixed curveThreshold() const { return m_curveThreshold; } - void joinPoints(qfixed x, qfixed y, const QLineF &nextLine, LineJoinMode join); inline void emitMoveTo(qfixed x, qfixed y); inline void emitLineTo(qfixed x, qfixed y); @@ -227,7 +238,6 @@ protected: qfixed m_strokeWidth; qfixed m_miterLimit; - qfixed m_curveThreshold; LineJoinMode m_capStyle; LineJoinMode m_joinStyle; |