[PATCH 2/2] image: Don't use the fast path if it's wrong

Uli Schlachter psychon at znc.in
Mon Mar 21 10:46:32 PDT 2011


TODO: Better commit message :(

Fixes the new "operator-source" test and the original report from:
http://lists.cairographics.org/archives/cairo/2011-March/021827.html

Signed-off-by: Uli Schlachter <psychon at znc.in>
---
 src/cairo-image-surface.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index bf22cb5..1104eda 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -2780,6 +2780,12 @@ _composite_unaligned_boxes (cairo_image_surface_t *dst,
     const struct _cairo_boxes_chunk *chunk;
     int i, src_x, src_y;
 
+    /* The below code breaks for unaligned boxes with operator source. This can
+     * best be seen with multiple boxes where black is drawn to dst outside of
+     * the boxes. */
+    if (op == CAIRO_OPERATOR_SOURCE && ! boxes->is_pixel_aligned)
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
     i = CAIRO_STRIDE_FOR_WIDTH_BPP (extents->bounded.width, 8) * extents->bounded.height;
     if ((unsigned) i <= sizeof (buf)) {
 	mask = pixman_image_create_bits (PIXMAN_a8,
-- 
1.7.2.3


--------------000300070308020509030106
Content-Type: application/octet-stream;
 name="test.c.sig"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="test.c.sig"

iQEcBAABCAAGBQJNh61WAAoJECLkKOvLj8sG/QYIAMvBEOdaRkXmAzow3rLpjeBs4iHRceAp
m1siRVnmdUWbiVDR3ZOEYuxzfFzT98R/IK7aS4Cws+VuMx+g6AQD1YSbcJvlmAp8VAgWI1F2
382+P51y6+jezmxMoP5pVa1D3SFxpgrg76AMBeotXM8b15CZa5cO6//Gwx5t6ev+o4hTGELb
SjaDByOb1/YojS1iFXKoTH5HvvhB3mxV13d/Qgr+fKNiapEWAkWO8hctGVyqx60VDk9thLx5
hkamQ6iEDzpTvZ96pgpRtcV+ldOZO+yNWxDWcMN5afWKllHba7BxmDuajXy6dKX4P5HPdfPi
gUbi38OkNU8+QoZ0XMx6MV8=
--------------000300070308020509030106
Content-Type: application/octet-stream;
 name="0001-Add-unaligned-boxes-to-operator-source-test.patch.sig"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*0="0001-Add-unaligned-boxes-to-operator-source-test.patch.sig"

iQEcBAABCAAGBQJNh61WAAoJECLkKOvLj8sGuIoIAJxDipY+Zua8pKsAyd/Woqd5I7Ij7Dhk
vKGNc5Cc+Rfvc2uY7qYh8OYUBd3B9mYFlozMUHE0owtVmmx0uLydMxT4ZhhGTr5zRz88CSSP
C7p4narZbZxK81xMHJA+HV/XbMfbjqFrMqSVas9xjCCZh9dAd+puIpuXvaMyewXnGgijlJ4K
ojt0snPJwNPdSsiyKDE9UGt3LsHYanNLOEd26tOpUBLqatNaTWjRIby6GViJMqooMeyOoCdR
0BxFYWlKUYJw/aCCOTMNh2qQaY4wyZqBka5xMRe9xq4FZ4KiEwfxa2hcN/E8EhgJhGIHjMJQ
bO+UVnIu6jcMr1yQDuhtukY=
--------------000300070308020509030106
Content-Type: application/octet-stream;
 name="0002-image-Don-t-use-the-fast-path-if-it-s-wrong.patch.sig"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*0="0002-image-Don-t-use-the-fast-path-if-it-s-wrong.patch.sig"

iQEcBAABCAAGBQJNh61WAAoJECLkKOvLj8sGMZkH/Resb7PQgWzyUxnyZVwTMqgA7k0OKk/O
waPXNg5pjbwoy+4Elg5vAifEZpVEb2DfraKM3AYuXcDW45F5DXc/HLcswEs+ZFyYvzbzqUft
l0oW2pbc4TzOIhXjN9vZJc6FsypJQwUUPNTTJTSb3yRfj90PmEAyNbopVf9KfdyATOG528RE
aMwt1Oh/+eUwLwlLAIzjPwfd51Pgqqhpe7K0cJs2hrSyDU5dmc8eEMVW5Fhj0N/zHKvgMeke
VGDiUoaJuv8hFRRov97EpxC4qc2YBP59wOlQ6JO7+CekI8mKJ/lh8gGjjU/pej/C3aXD5nos
JES/hancQHJOggHBV5P1Jcw=
--------------000300070308020509030106--


More information about the cairo mailing list