summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-31 17:45:02 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-31 19:15:01 +0000
commit8939ddbc27efedbb3e446dd26425a6bed39577f2 (patch)
tree086559ec41280ea7b3425943e70548312c16c360
parent98b830a975e04685455b244a8414a293857cbd00 (diff)
sna: Improve rendering of thin segments
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c52
1 files changed, 23 insertions, 29 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index cf3f5d3c..346038ec 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3820,6 +3820,8 @@ rectangle_continue:
*/
if (pt2_clipped)
length++;
+ if (length == 0)
+ continue;
if (pt1_clipped) {
int clipdx = abs(x1 - x);
@@ -3827,24 +3829,22 @@ rectangle_continue:
e += clipdy * e2 + (clipdx - clipdy) * e1;
}
}
- if (length == 0)
- continue;
-
e3 = e2 - e1;
e = e - e1;
+ if (sdx < 0) {
+ x1 = x2;
+ y1 = y2;
+ sdy = -sdy;
+ }
+
b->x1 = x1;
b->y2 = b->y1 = y1;
while (--length) {
e += e1;
+ x1++;
if (e >= 0) {
b->x2 = x1;
- if (b->x2 < b->x1) {
- int16_t t = b->x1;
- b->x1 = b->x2;
- b->x2 = t;
- }
- b->x2++;
b->y2++;
if (++b == last_box) {
ret = &&X_continue;
@@ -3855,19 +3855,11 @@ X_continue:
y1 += sdy;
e += e3;
b->y2 = b->y1 = y1;
- b->x1 = x1 + sdx;
+ b->x1 = x1;
}
- x1 += sdx;
}
- b->x2 = x1;
- if (b->x2 < b->x1) {
- int16_t t = b->x1;
- b->x1 = b->x2;
- b->x2 = t;
- }
- if (gc->capStyle != CapNotLast)
- b->x2++;
+ b->x2 = ++x1;
b->y2++;
if (++b == last_box) {
ret = &&X_continue2;
@@ -3906,6 +3898,8 @@ X_continue2:
*/
if (pt2_clipped)
length++;
+ if (length == 0)
+ continue;
if (pt1_clipped) {
int clipdx = abs(x1 - x);
@@ -3913,16 +3907,21 @@ X_continue2:
e += clipdx * e2 + (clipdy - clipdx) * e1;
}
}
- if (length == 0)
- continue;
e3 = e2 - e1;
e = e - e1;
+ if (sdx < 0) {
+ x1 = x2;
+ y1 = y2;
+ sdy = -sdy;
+ }
+
b->x2 = b->x1 = x1;
b->y1 = y1;
while (--length) {
e += e1;
+ y1 += sdy;
if (e >= 0) {
b->y2 = y1;
if (b->y2 < b->y1) {
@@ -3931,30 +3930,25 @@ X_continue2:
b->y2 = t;
}
b->x2++;
- b->y2++;
if (++b == last_box) {
ret = &&Y_continue;
goto *jump;
Y_continue:
b = box;
}
- x1 += sdx;
e += e3;
- b->x2 = b->x1 = x1;
- b->y1 = y1 + sdy;
+ b->x2 = b->x1 = ++x1;
+ b->y1 = y1;
}
- y1 += sdy;
}
- b->y2 = y1;
+ b->y2 = y1 + sdy;
if (b->y2 < b->y1) {
int16_t t = b->y1;
b->y1 = b->y2;
b->y2 = t;
}
b->x2++;
- if (gc->capStyle != CapNotLast)
- b->y2++;
if (++b == last_box) {
ret = &&Y_continue2;
goto *jump;