summaryrefslogtreecommitdiffstats
path: root/gfx/cairo/pixman-image-transform.patch
blob: 2f93d315a5dc25ce814261fe456087d56771e1e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# HG changeset patch
# User Jeff Muizelaar <jmuizelaar@mozilla.com>
# Date 1299543337 18000
# Node ID 57f411f16517fa3abc31b6b081dd31420c4d9b45
# Parent  e56ecd8b3a68c158025207c5fd081d043e28f5ce
Bug 637828. Reset the transform on the dest image. r=joe

We can get into a situation where the destination image has a transform
because we use it as source. The transform set when the image is a source
sticks around and when we use it as a destination pixman gets confused.

It seems like the code at fault here is really pixman. I think that pixman
should probably not be using a transformed fetch on the destination image under
any circumstances.

For example, in this case we're fetching destination pixels from a different
part of the image than we're storing them to. I can't see any reason for
wanting this behaviour.

However, reseting the transform seemed like the easiest solution.

diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c
--- a/gfx/cairo/cairo/src/cairo-image-surface.c
+++ b/gfx/cairo/cairo/src/cairo-image-surface.c
@@ -1138,16 +1138,27 @@ _cairo_image_surface_composite (cairo_op
 	return status;
 
     status = _cairo_image_surface_set_attributes (src, &src_attr,
 						  dst_x + width / 2.,
 						  dst_y + height / 2.);
     if (unlikely (status))
 	goto CLEANUP_SURFACES;
 
+    /* we sometimes get destinations with transforms.
+     * we're not equiped to deal with this */
+    {
+        static const pixman_transform_t id = {
+           {{ pixman_fixed_1, 0, 0 },
+            { 0, pixman_fixed_1, 0 },
+            { 0, 0, pixman_fixed_1 }}
+        };
+        pixman_image_set_transform (dst->pixman_image, &id);
+    }
+
     if (mask) {
 	status = _cairo_image_surface_set_attributes (mask, &mask_attr,
 						      dst_x + width / 2.,
 						      dst_y + height / 2.);
 	if (unlikely (status))
 	    goto CLEANUP_SURFACES;
 
 	pixman_image_composite (_pixman_operator (op),