diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-05-05 05:24:53 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-05-05 05:24:53 (GMT) |
commit | ba8ff70b5ac7b68be57a4b63e439fd5a37c4aafa (patch) | |
tree | 4a191e30db11d1ae3fad2a937ef26e3c98478668 /src/gui/painting | |
parent | ac4b7b8ae7c7a18d9af4f21367148b9fdec4816e (diff) | |
download | Qt-ba8ff70b5ac7b68be57a4b63e439fd5a37c4aafa.zip Qt-ba8ff70b5ac7b68be57a4b63e439fd5a37c4aafa.tar.gz Qt-ba8ff70b5ac7b68be57a4b63e439fd5a37c4aafa.tar.bz2 |
Turn off smooth rendering for qDrawBorderPixmap() with transforms.
On non-gl graphics systems smooth rendering of qDrawBorderPixmap()
with a transform applied resulted in ugly artifacts. Better to draw
without smooth and get a correct looking result, though with jaggy edges.
Task-number: QTBUG-5687
Reviewed-by: Gunnar
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qdrawutil.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index a62f06b..ef9b18c 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1137,6 +1137,15 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin xTarget.resize(columns + 1); yTarget.resize(rows + 1); + bool oldAA = painter->testRenderHint(QPainter::Antialiasing); + bool oldSmooth = painter->testRenderHint(QPainter::SmoothPixmapTransform); + if (painter->paintEngine()->type() != QPaintEngine::OpenGL + && painter->paintEngine()->type() != QPaintEngine::OpenGL2 + && (oldSmooth || oldAA) && painter->combinedTransform().type() != QTransform::TxNone) { + painter->setRenderHint(QPainter::Antialiasing, false); + painter->setRenderHint(QPainter::SmoothPixmapTransform, false); + } + xTarget[0] = targetRect.left(); xTarget[1] = targetCenterLeft; xTarget[columns - 1] = targetCenterRight; @@ -1342,6 +1351,11 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin painter->drawPixmapFragments(opaqueData.data(), opaqueData.size(), pixmap, QPainter::OpaqueHint); if (translucentData.size()) painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap); + + if (oldAA) + painter->setRenderHint(QPainter::Antialiasing, true); + if (oldSmooth) + painter->setRenderHint(QPainter::SmoothPixmapTransform, true); } QT_END_NAMESPACE |