summaryrefslogtreecommitdiffstats
path: root/meta/recipes-qt/qt4/qt4-4.8.5
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-qt/qt4/qt4-4.8.5')
-rw-r--r--meta/recipes-qt/qt4/qt4-4.8.5/0022-Fix-drawing-of-0-width-polylines-from-outside-the-de.patch148
1 files changed, 148 insertions, 0 deletions
diff --git a/meta/recipes-qt/qt4/qt4-4.8.5/0022-Fix-drawing-of-0-width-polylines-from-outside-the-de.patch b/meta/recipes-qt/qt4/qt4-4.8.5/0022-Fix-drawing-of-0-width-polylines-from-outside-the-de.patch
new file mode 100644
index 0000000000..ad45dd0511
--- /dev/null
+++ b/meta/recipes-qt/qt4/qt4-4.8.5/0022-Fix-drawing-of-0-width-polylines-from-outside-the-de.patch
@@ -0,0 +1,148 @@
1From b7029fbd12c32e851ed7d81b692197176eb71d9e Mon Sep 17 00:00:00 2001
2From: Gunnar Sletta <gunnar.sletta@digia.com>
3Date: Thu, 4 Jul 2013 16:20:40 +1000
4Subject: [PATCH] Fix drawing of 0-width polylines from outside the devicerect.
5
6This was broken by a previous fix which aimed to fix gaps in
7polylines with tiny line segments. The result was that we
8skipped updating the origin point when stroke() didn't produce
9pixels which accidentally included the case of the line
10being completely outside the deviceRect. I fixed this
11by returning the value of clipLine in drawLine to the caller
12so we could still update the origin for this case.
13
14Upstream-Status: Accepted [https://codereview.qt-project.org/#change,60427]
15Signed-off-by: Jonathan Liu <net147@gmail.com>
16
17Task-number: QTBUG-31579
18Change-Id: Iac29436f042da7658bbeaf9370351dc6f2c95065
19(cherry picked from qtbase/900cccfd459fcbdbc4aa3d313afe12cfbf68fd87)
20---
21 src/gui/painting/qcosmeticstroker.cpp | 42 ++++++++++++++++++++++-------------
22 src/gui/painting/qcosmeticstroker_p.h | 2 +-
23 2 files changed, 27 insertions(+), 17 deletions(-)
24
25diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
26index 0061ecb..4413170 100644
27--- a/src/gui/painting/qcosmeticstroker.cpp
28+++ b/src/gui/painting/qcosmeticstroker.cpp
29@@ -133,10 +133,15 @@ struct NoDasher {
30
31 };
32
33+/*
34+ * The return value is the result of the clipLine() call performed at the start
35+ * of each of the two functions, aka "false" means completely outside the devices
36+ * rect.
37+ */
38 template<DrawPixel drawPixel, class Dasher>
39-static void drawLine(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps);
40+static bool drawLine(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps);
41 template<DrawPixel drawPixel, class Dasher>
42-static void drawLineAA(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps);
43+static bool drawLineAA(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps);
44
45 inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage)
46 {
47@@ -602,17 +607,20 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
48 caps |= CapEnd;
49
50 QCosmeticStroker::Point last = this->lastPixel;
51- stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps);
52+ bool unclipped = stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps);
53
54 /* fix for gaps in polylines with fastpen and aliased in a sequence
55 of points with small distances: if current point p2 has been dropped
56- out, keep last non dropped point p. */
57- if (fastPenAliased) {
58- if (last.x != lastPixel.x || last.y != lastPixel.y ||
59- points == begin + 2 || points == end - 2 ) {
60- {
61- p = p2;
62- }
63+ out, keep last non dropped point p.
64+
65+ However, if the line was completely outside the devicerect, we
66+ still need to update p to avoid drawing the line after this one from
67+ a bad starting position.
68+ */
69+ if (fastPenAliased && unclipped) {
70+ if (last.x != lastPixel.x || last.y != lastPixel.y
71+ || points == begin + 2 || points == end - 2) {
72+ p = p2;
73 }
74 } else {
75 p = p2;
76@@ -720,10 +728,10 @@ static inline void capAdjust(int caps, int &x1, int &x2, int &y, int yinc)
77 the drawing shifts from horizontal to vertical or back.
78 */
79 template<DrawPixel drawPixel, class Dasher>
80-static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps)
81+static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps)
82 {
83 if (stroker->clipLine(rx1, ry1, rx2, ry2))
84- return;
85+ return false;
86
87 static const int half = 31;
88 int x1 = toF26Dot6(rx1) + half;
89@@ -813,7 +821,7 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
90 } else {
91 // horizontal
92 if (!dx)
93- return;
94+ return true;
95
96 QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight;
97
98@@ -886,14 +894,15 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
99 }
100 }
101 stroker->lastPixel = last;
102+ return true;
103 }
104
105
106 template<DrawPixel drawPixel, class Dasher>
107-static void drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps)
108+static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps)
109 {
110 if (stroker->clipLine(rx1, ry1, rx2, ry2))
111- return;
112+ return false;
113
114 int x1 = toF26Dot6(rx1);
115 int y1 = toF26Dot6(ry1);
116@@ -967,7 +976,7 @@ static void drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
117 } else {
118 // horizontal
119 if (!dx)
120- return;
121+ return true;
122
123 int yinc = F16Dot16FixedDiv(dy, dx);
124
125@@ -1029,6 +1038,7 @@ static void drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
126 drawPixel(stroker, x, (y>>16) + 1, alpha * alphaEnd >> 6);
127 }
128 }
129+ return true;
130 }
131
132 QT_END_NAMESPACE
133diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
134index 870738b..3216856 100644
135--- a/src/gui/painting/qcosmeticstroker_p.h
136+++ b/src/gui/painting/qcosmeticstroker_p.h
137@@ -56,7 +56,7 @@ QT_MODULE(Gui)
138 class QCosmeticStroker;
139
140
141-typedef void (*StrokeLine)(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps);
142+typedef bool (*StrokeLine)(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps);
143
144 class QCosmeticStroker
145 {
146--
1471.8.3.2
148