summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-07-23 12:30:57 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-07-23 13:10:54 (GMT)
commit2851458fbefcc4785a1a76f5216af6159d6c7116 (patch)
treea3aa2b8be9ef18b2f44c2822d9c815620371a831 /src/gui
parent9fd510721a140c46ce371b0c7bbc6917e3709c1d (diff)
downloadQt-2851458fbefcc4785a1a76f5216af6159d6c7116.zip
Qt-2851458fbefcc4785a1a76f5216af6159d6c7116.tar.gz
Qt-2851458fbefcc4785a1a76f5216af6159d6c7116.tar.bz2
Diagonal dashes are moving when touching the clip boundary.
We normally pad the clip rect with the size of the pen and miterlimit to avoid this, but this didn't handle the case where there was a long diagonal dash. We also need to multiply the padding with the longest dash. Reviewed-By: Tom Cooksey
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qstroker.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index ceafe4c..362b0b3 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -1012,10 +1012,13 @@ void QDashStroker::processCurrentSubpath()
int dashCount = qMin(m_dashPattern.size(), 32);
qfixed dashes[32];
+ qreal longestLength = 0;
qreal sumLength = 0;
for (int i=0; i<dashCount; ++i) {
dashes[i] = qMax(m_dashPattern.at(i), qreal(0)) * m_stroker->strokeWidth();
sumLength += dashes[i];
+ if (dashes[i] > longestLength)
+ longestLength = dashes[i];
}
if (qFuzzyCompare(sumLength + 1, qreal(1)))
@@ -1053,7 +1056,7 @@ void QDashStroker::processCurrentSubpath()
qfixed2d line_to_pos;
// Pad to avoid clipping the borders of thick pens.
- qfixed padding = qMax(m_stroker->strokeWidth(), m_stroker->miterLimit());
+ qfixed padding = qt_real_to_fixed(qMax(m_stroker->strokeWidth(), m_stroker->miterLimit()) * longestLength);
qfixed2d clip_tl = { qt_real_to_fixed(m_clip_rect.left()) - padding,
qt_real_to_fixed(m_clip_rect.top()) - padding };
qfixed2d clip_br = { qt_real_to_fixed(m_clip_rect.right()) + padding ,