Lines 1-111
Link Here
|
1 |
From 48a33fc379b17eed195875222ad773c911d9dff1 Mon Sep 17 00:00:00 2001 |
|
|
2 |
From: Chris Wilson <chris@chris-wilson.co.uk> |
3 |
Date: Tue, 2 Sep 2014 19:08:36 +0100 |
4 |
Subject: sna/trapezoids: Use the corrected trapezoid origin for aligned boxes |
5 |
|
6 |
The rule for the origin of the CompositeTrapezoids routine is the |
7 |
upper-left corner of the first trapezoid. Care must be taken in case the |
8 |
trapezoid edge is upside down to consider the upper vertex. |
9 |
|
10 |
Reported-by: "Jasper St. Pierre" <jstpierre@mecheye.net> |
11 |
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> |
12 |
|
13 |
|
14 |
--- src/sna/sna_trapezoids.c.orig 2013-08-20 22:26:26.000000000 +0200 |
15 |
+++ src/sna/sna_trapezoids.c 2015-04-12 16:40:02.382938000 +0200 |
16 |
@@ -2690,13 +2690,16 @@ |
17 |
BoxRec stack_boxes[64], *boxes; |
18 |
pixman_region16_t region, clip; |
19 |
struct sna_composite_op tmp; |
20 |
+ int16_t dst_x, dst_y; |
21 |
bool ret = true; |
22 |
int dx, dy, n, num_boxes; |
23 |
|
24 |
if (NO_ALIGNED_BOXES) |
25 |
return false; |
26 |
|
27 |
- DBG(("%s\n", __FUNCTION__)); |
28 |
+ DBG(("%s: pixmap=%ld, nboxes=%d, dx=(%d, %d)\n", __FUNCTION__, |
29 |
+ get_drawable_pixmap(dst->pDrawable)->drawable.serialNumber, |
30 |
+ ntrap, dst->pDrawable->x, dst->pDrawable->y)); |
31 |
|
32 |
boxes = stack_boxes; |
33 |
if (ntrap > (int)ARRAY_SIZE(stack_boxes)) { |
34 |
@@ -2738,19 +2741,20 @@ |
35 |
if (num_boxes == 0) |
36 |
goto free_boxes; |
37 |
|
38 |
- DBG(("%s: extents (%d, %d), (%d, %d) offset of (%d, %d)\n", |
39 |
+ trapezoid_origin(&traps[0].left, &dst_x, &dst_y); |
40 |
+ |
41 |
+ DBG(("%s: extents (%d, %d), (%d, %d) offset of (%d, %d), origin (%d, %d)\n", |
42 |
__FUNCTION__, |
43 |
region.extents.x1, region.extents.y1, |
44 |
region.extents.x2, region.extents.y2, |
45 |
region.extents.x1 - boxes[0].x1, |
46 |
- region.extents.y1 - boxes[0].y1)); |
47 |
- |
48 |
- src_x += region.extents.x1 - boxes[0].x1; |
49 |
- src_y += region.extents.y1 - boxes[0].y1; |
50 |
+ region.extents.y1 - boxes[0].y1, |
51 |
+ dst_x, dst_y)); |
52 |
|
53 |
if (!sna_compute_composite_region(&clip, |
54 |
src, NULL, dst, |
55 |
- src_x, src_y, |
56 |
+ src_x + region.extents.x1 - dst_x - dx, |
57 |
+ src_y + region.extents.y1 - dst_y - dy, |
58 |
0, 0, |
59 |
region.extents.x1 - dx, region.extents.y1 - dy, |
60 |
region.extents.x2 - region.extents.x1, |
61 |
@@ -2760,9 +2764,18 @@ |
62 |
goto done; |
63 |
} |
64 |
|
65 |
+ DBG(("%s: clipped extents (%d, %d), (%d, %d); now offset by (%d, %d), orgin (%d, %d)\n", |
66 |
+ __FUNCTION__, |
67 |
+ clip.extents.x1, clip.extents.y1, |
68 |
+ clip.extents.x2, clip.extents.y2, |
69 |
+ clip.extents.x1 - boxes[0].x1, |
70 |
+ clip.extents.y1 - boxes[0].y1, |
71 |
+ dst_x, dst_y)); |
72 |
+ |
73 |
if (force_fallback || |
74 |
!sna->render.composite(sna, op, src, NULL, dst, |
75 |
- src_x, src_y, |
76 |
+ src_x + clip.extents.x1 - dst_x, |
77 |
+ src_y + clip.extents.y1 - dst_y, |
78 |
0, 0, |
79 |
clip.extents.x1, clip.extents.y1, |
80 |
clip.extents.x2 - clip.extents.x1, |
81 |
@@ -2796,6 +2809,8 @@ |
82 |
} |
83 |
|
84 |
DBG(("%s: fbComposite()\n", __FUNCTION__)); |
85 |
+ src_x -= dst_x - dx; |
86 |
+ src_y -= dst_y - dy; |
87 |
if (maskFormat) { |
88 |
pixman_region_init_rects(®ion, boxes, num_boxes); |
89 |
RegionIntersect(®ion, ®ion, &clip); |
90 |
@@ -2804,8 +2819,8 @@ |
91 |
count = REGION_NUM_RECTS(®ion); |
92 |
for (i = 0; i < count; i++) { |
93 |
fbComposite(op, src, NULL, dst, |
94 |
- src_x + b[i].x1 - boxes[0].x1, |
95 |
- src_y + b[i].y1 - boxes[0].y1, |
96 |
+ src_x + b[i].x1, |
97 |
+ src_y + b[i].y1, |
98 |
0, 0, |
99 |
b[i].x1, b[i].y1, |
100 |
b[i].x2 - b[i].x1, b[i].y2 - b[i].y1); |
101 |
@@ -2819,8 +2834,8 @@ |
102 |
count = REGION_NUM_RECTS(®ion); |
103 |
for (i = 0; i < count; i++) { |
104 |
fbComposite(op, src, NULL, dst, |
105 |
- src_x + b[i].x1 - boxes[0].x1, |
106 |
- src_y + b[i].y1 - boxes[0].y1, |
107 |
+ src_x + b[i].x1, |
108 |
+ src_y + b[i].y1, |
109 |
0, 0, |
110 |
b[i].x1, b[i].y1, |
111 |
b[i].x2 - b[i].x1, b[i].y2 - b[i].y1); |