diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-11-05 13:58:43 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-11-05 14:18:11 (GMT) |
commit | 86388f7a5224da867ace47a41ed93982dfed7cfc (patch) | |
tree | 939ba67bccc3971aa890cbe8ccce711be5a4b972 /src | |
parent | 0818c05f22509a4ee9310f1d313460f422d9d32b (diff) | |
download | Qt-86388f7a5224da867ace47a41ed93982dfed7cfc.zip Qt-86388f7a5224da867ace47a41ed93982dfed7cfc.tar.gz Qt-86388f7a5224da867ace47a41ed93982dfed7cfc.tar.bz2 |
Use fallback stroker for cosmetic strokes with asymetric transforms
Reviewed-by: Samuel
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qtransform.cpp | 9 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 8118450..1bd5842 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -2214,12 +2214,14 @@ bool qt_scaleForTransform(const QTransform &transform, qreal *scale) { const QTransform::TransformationType type = transform.type(); if (type <= QTransform::TxTranslate) { - *scale = 1; + if (scale) + *scale = 1; return true; } else if (type == QTransform::TxScale) { const qreal xScale = qAbs(transform.m11()); const qreal yScale = qAbs(transform.m22()); - *scale = qMax(xScale, yScale); + if (scale) + *scale = qMax(xScale, yScale); return qFuzzyCompare(xScale, yScale); } @@ -2227,7 +2229,8 @@ bool qt_scaleForTransform(const QTransform &transform, qreal *scale) + transform.m21() * transform.m21(); const qreal yScale = transform.m12() * transform.m12() + transform.m22() * transform.m22(); - *scale = qSqrt(qMax(xScale, yScale)); + if (scale) + *scale = qSqrt(qMax(xScale, yScale)); return type == QTransform::TxRotate && qFuzzyCompare(xScale, yScale); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index d20700f..1527e72 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1221,6 +1221,9 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) } } +extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp + + void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) { Q_D(QGL2PaintEngineEx); @@ -1231,6 +1234,11 @@ void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) return; QOpenGL2PaintEngineState *s = state(); + if (pen.isCosmetic() && !qt_scaleForTransform(s->transform(), 0)) { + // QTriangulatingStroker class is not meant to support cosmetically sheared strokes. + QPaintEngineEx::stroke(path, pen); + return; + } ensureActive(); |