diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-06-27 17:53:18 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-06-27 17:53:18 +0100 |
commit | 86624627e4b196a78cfd9bd642299441e838e0f2 (patch) | |
tree | 49edd056650918b296654c4b1db402ea9142b80f | |
parent | c506ddb58612c69b80b08be3a6d14c5bcc1ac21f (diff) |
[test] Add group-unaligned
Test case for:
Bug 22441 -- Unexpected shift with push_group and pop_group
https://bugs.freedesktop.org/show_bug.cgi?id=22441
This is a test that demonstrates the error in the pdf backend when using
groups on surfaces with non-integer sizes. In order to create such a
surface, we need to update the boilerplate to use doubles instead of
integers when specifying the surface size.
42 files changed, 312 insertions, 235 deletions
diff --git a/boilerplate/cairo-boilerplate-beos-private.h b/boilerplate/cairo-boilerplate-beos-private.h index 1d800c26..4505d738 100644 --- a/boilerplate/cairo-boilerplate-beos-private.h +++ b/boilerplate/cairo-boilerplate-beos-private.h @@ -10,10 +10,10 @@ CAIRO_BEGIN_DECLS extern cairo_surface_t * _cairo_boilerplate_beos_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -24,10 +24,10 @@ _cairo_boilerplate_beos_cleanup (void* closure); extern cairo_surface_t * _cairo_boilerplate_beos_create_surface_for_bitmap (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-beos.cpp b/boilerplate/cairo-boilerplate-beos.cpp index 497d9277..f5276276 100644 --- a/boilerplate/cairo-boilerplate-beos.cpp +++ b/boilerplate/cairo-boilerplate-beos.cpp @@ -172,8 +172,8 @@ struct beos_boilerplate_closure cairo_surface_t * _cairo_boilerplate_beos_create_surface (const char *name, cairo_content_t content, - int width, - int height, + double width, + double height, cairo_boilerplate_mode_t mode, void **closure) { @@ -207,8 +207,8 @@ _cairo_boilerplate_beos_cleanup (void* closure) cairo_surface_t * _cairo_boilerplate_beos_create_surface_for_bitmap (const char *name, cairo_content_t content, - int width, - int height, + double width, + double height, cairo_boilerplate_mode_t mode, void **closure) { diff --git a/boilerplate/cairo-boilerplate-directfb-private.h b/boilerplate/cairo-boilerplate-directfb-private.h index 87d1b8b0..a34edcba 100644 --- a/boilerplate/cairo-boilerplate-directfb-private.h +++ b/boilerplate/cairo-boilerplate-directfb-private.h @@ -10,10 +10,10 @@ CAIRO_BEGIN_DECLS extern cairo_surface_t * _cairo_boilerplate_directfb_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-directfb.c b/boilerplate/cairo-boilerplate-directfb.c index 7a6462f6..ea7a8ad9 100644 --- a/boilerplate/cairo-boilerplate-directfb.c +++ b/boilerplate/cairo-boilerplate-directfb.c @@ -171,10 +171,10 @@ ERROR: cairo_surface_t * _cairo_boilerplate_directfb_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-glitz-agl.c b/boilerplate/cairo-boilerplate-glitz-agl.c index dd10a00e..03d0423b 100644 --- a/boilerplate/cairo-boilerplate-glitz-agl.c +++ b/boilerplate/cairo-boilerplate-glitz-agl.c @@ -101,10 +101,10 @@ _cairo_boilerplate_glitz_agl_create_surface_internal (glitz_format_name_t form cairo_surface_t * _cairo_boilerplate_glitz_agl_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-glitz-glx.c b/boilerplate/cairo-boilerplate-glitz-glx.c index 4c26b877..a1981ebf 100644 --- a/boilerplate/cairo-boilerplate-glitz-glx.c +++ b/boilerplate/cairo-boilerplate-glitz-glx.c @@ -153,11 +153,11 @@ _cairo_boilerplate_glitz_glx_create_surface_internal (glitz_format_name_t form cairo_surface_t * _cairo_boilerplate_glitz_glx_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-glitz-private.h b/boilerplate/cairo-boilerplate-glitz-private.h index 052c7e06..62904c7c 100644 --- a/boilerplate/cairo-boilerplate-glitz-private.h +++ b/boilerplate/cairo-boilerplate-glitz-private.h @@ -41,10 +41,10 @@ typedef struct _glitz_target_closure_base { cairo_surface_t * _cairo_boilerplate_glitz_glx_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -57,10 +57,10 @@ _cairo_boilerplate_glitz_glx_cleanup (void *closure); cairo_surface_t * _cairo_boilerplate_glitz_agl_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -73,10 +73,10 @@ _cairo_boilerplate_glitz_agl_cleanup (void *closure); cairo_surface_t * _cairo_boilerplate_glitz_wgl_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-glitz-wgl.c b/boilerplate/cairo-boilerplate-glitz-wgl.c index dfd764f6..9cd11b60 100644 --- a/boilerplate/cairo-boilerplate-glitz-wgl.c +++ b/boilerplate/cairo-boilerplate-glitz-wgl.c @@ -100,10 +100,10 @@ _cairo_boilerplate_glitz_wgl_create_surface_internal (glitz_format_name_t form cairo_surface_t * _cairo_boilerplate_glitz_wgl_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-pdf-private.h b/boilerplate/cairo-boilerplate-pdf-private.h index 3c34c3ef..f4affe76 100644 --- a/boilerplate/cairo-boilerplate-pdf-private.h +++ b/boilerplate/cairo-boilerplate-pdf-private.h @@ -30,10 +30,10 @@ cairo_surface_t * _cairo_boilerplate_pdf_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c index c3289f8f..3ac380c2 100644 --- a/boilerplate/cairo-boilerplate-pdf.c +++ b/boilerplate/cairo-boilerplate-pdf.c @@ -51,10 +51,10 @@ typedef struct _pdf_target_closure cairo_surface_t * _cairo_boilerplate_pdf_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -69,8 +69,8 @@ _cairo_boilerplate_pdf_create_surface (const char *name, *closure = ptc = xmalloc (sizeof (pdf_target_closure_t)); - ptc->width = width; - ptc->height = height; + ptc->width = ceil (width); + ptc->height = ceil (height); xasprintf (&ptc->filename, "%s.out.pdf", name); xunlink (ptc->filename); @@ -85,7 +85,7 @@ _cairo_boilerplate_pdf_create_surface (const char *name, ptc->target = surface; surface = cairo_surface_create_similar (ptc->target, CAIRO_CONTENT_COLOR, - width, height); + ptc->width, ptc->height); if (cairo_surface_status (surface)) goto CLEANUP_TARGET; } else { diff --git a/boilerplate/cairo-boilerplate-ps-private.h b/boilerplate/cairo-boilerplate-ps-private.h index b97c7db9..7bcce1c0 100644 --- a/boilerplate/cairo-boilerplate-ps-private.h +++ b/boilerplate/cairo-boilerplate-ps-private.h @@ -30,10 +30,10 @@ cairo_surface_t * _cairo_boilerplate_ps2_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -41,10 +41,10 @@ _cairo_boilerplate_ps2_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_ps3_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c index c3efceab..2fb03e89 100644 --- a/boilerplate/cairo-boilerplate-ps.c +++ b/boilerplate/cairo-boilerplate-ps.c @@ -68,10 +68,10 @@ static cairo_surface_t * _cairo_boilerplate_ps_create_surface (const char *name, cairo_content_t content, cairo_ps_level_t level, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -90,8 +90,8 @@ _cairo_boilerplate_ps_create_surface (const char *name, xunlink (ptc->filename); ptc->level = level; - ptc->width = width; - ptc->height = height; + ptc->width = ceil (width); + ptc->height = ceil (height); surface = cairo_ps_surface_create (ptc->filename, width, height); if (cairo_surface_status (surface)) @@ -105,7 +105,7 @@ _cairo_boilerplate_ps_create_surface (const char *name, ptc->target = surface; surface = cairo_surface_create_similar (ptc->target, CAIRO_CONTENT_COLOR, - width, height); + ptc->width, ptc->height); if (cairo_surface_status (surface)) goto CLEANUP_TARGET; } else { @@ -130,10 +130,10 @@ _cairo_boilerplate_ps_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_ps2_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -149,10 +149,10 @@ _cairo_boilerplate_ps2_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_ps3_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-qt-private.h b/boilerplate/cairo-boilerplate-qt-private.h index 4ac87642..917d63b4 100644 --- a/boilerplate/cairo-boilerplate-qt-private.h +++ b/boilerplate/cairo-boilerplate-qt-private.h @@ -39,11 +39,11 @@ CAIRO_BEGIN_DECLS extern cairo_surface_t * _cairo_boilerplate_qt_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-qt.cpp b/boilerplate/cairo-boilerplate-qt.cpp index 0e0aa7db..addcb12e 100644 --- a/boilerplate/cairo-boilerplate-qt.cpp +++ b/boilerplate/cairo-boilerplate-qt.cpp @@ -56,10 +56,10 @@ _cairo_boilerplate_qt_cleanup (void *closure) cairo_surface_t * _cairo_boilerplate_qt_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-quartz-private.h b/boilerplate/cairo-boilerplate-quartz-private.h index 573e247e..ccf8a9ac 100644 --- a/boilerplate/cairo-boilerplate-quartz-private.h +++ b/boilerplate/cairo-boilerplate-quartz-private.h @@ -30,10 +30,10 @@ cairo_surface_t * _cairo_boilerplate_quartz_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-quartz.c b/boilerplate/cairo-boilerplate-quartz.c index 30652131..0b5b49d5 100644 --- a/boilerplate/cairo-boilerplate-quartz.c +++ b/boilerplate/cairo-boilerplate-quartz.c @@ -32,10 +32,10 @@ cairo_surface_t * _cairo_boilerplate_quartz_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-script-private.h b/boilerplate/cairo-boilerplate-script-private.h index 480e4221..ad01d629 100644 --- a/boilerplate/cairo-boilerplate-script-private.h +++ b/boilerplate/cairo-boilerplate-script-private.h @@ -30,10 +30,10 @@ cairo_surface_t * _cairo_boilerplate_script_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-script.c b/boilerplate/cairo-boilerplate-script.c index ae08cbc5..3d78078c 100644 --- a/boilerplate/cairo-boilerplate-script.c +++ b/boilerplate/cairo-boilerplate-script.c @@ -33,17 +33,17 @@ cairo_user_data_key_t script_closure_key; typedef struct _script_target_closure { char *filename; - int width; - int height; + double width; + double height; } script_target_closure_t; cairo_surface_t * _cairo_boilerplate_script_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-svg-private.h b/boilerplate/cairo-boilerplate-svg-private.h index d8c0a8fb..5a64eaf0 100644 --- a/boilerplate/cairo-boilerplate-svg-private.h +++ b/boilerplate/cairo-boilerplate-svg-private.h @@ -30,10 +30,10 @@ cairo_surface_t * _cairo_boilerplate_svg11_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -41,10 +41,10 @@ _cairo_boilerplate_svg11_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_svg12_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c index e6c1355f..407214c7 100644 --- a/boilerplate/cairo-boilerplate-svg.c +++ b/boilerplate/cairo-boilerplate-svg.c @@ -48,10 +48,10 @@ static cairo_surface_t * _cairo_boilerplate_svg_create_surface (const char *name, cairo_content_t content, cairo_svg_version_t version, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -62,8 +62,8 @@ _cairo_boilerplate_svg_create_surface (const char *name, *closure = ptc = xmalloc (sizeof (svg_target_closure_t)); - ptc->width = width; - ptc->height = height; + ptc->width = ceil (width); + ptc->height = ceil (height); xasprintf (&ptc->filename, "%s.out.svg", name); xunlink (ptc->filename); @@ -79,7 +79,7 @@ _cairo_boilerplate_svg_create_surface (const char *name, ptc->target = surface; surface = cairo_surface_create_similar (ptc->target, CAIRO_CONTENT_COLOR, - width, height); + ptc->width, ptc->height); if (cairo_surface_status (surface)) goto CLEANUP_TARGET; } else @@ -103,10 +103,10 @@ _cairo_boilerplate_svg_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_svg11_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -123,10 +123,10 @@ _cairo_boilerplate_svg11_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_svg12_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-test-surfaces-private.h b/boilerplate/cairo-boilerplate-test-surfaces-private.h index 55134fe5..57bf62dd 100644 --- a/boilerplate/cairo-boilerplate-test-surfaces-private.h +++ b/boilerplate/cairo-boilerplate-test-surfaces-private.h @@ -30,10 +30,10 @@ cairo_surface_t * _cairo_boilerplate_test_fallback_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -41,10 +41,10 @@ _cairo_boilerplate_test_fallback_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_test_fallback16_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -53,10 +53,10 @@ _cairo_boilerplate_test_fallback16_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_test_meta_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -64,10 +64,10 @@ _cairo_boilerplate_test_meta_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_test_null_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -75,10 +75,10 @@ _cairo_boilerplate_test_null_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_test_paginated_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-test-surfaces.c b/boilerplate/cairo-boilerplate-test-surfaces.c index 0fc92e3f..0fec3933 100644 --- a/boilerplate/cairo-boilerplate-test-surfaces.c +++ b/boilerplate/cairo-boilerplate-test-surfaces.c @@ -38,10 +38,10 @@ cairo_surface_t * _cairo_boilerplate_test_fallback_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -53,10 +53,10 @@ _cairo_boilerplate_test_fallback_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_test_fallback16_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -68,10 +68,10 @@ _cairo_boilerplate_test_fallback16_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_test_meta_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -83,10 +83,10 @@ _cairo_boilerplate_test_meta_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_test_null_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -108,10 +108,10 @@ typedef struct { cairo_surface_t * _cairo_boilerplate_test_paginated_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-win32-printing.c b/boilerplate/cairo-boilerplate-win32-printing.c index 13a65515..7a6dafc9 100644 --- a/boilerplate/cairo-boilerplate-win32-printing.c +++ b/boilerplate/cairo-boilerplate-win32-printing.c @@ -164,10 +164,10 @@ create_printer_dc (win32_target_closure_t *ptc) cairo_surface_t * _cairo_boilerplate_win32_printing_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-win32-private.h b/boilerplate/cairo-boilerplate-win32-private.h index fc039ae7..b09b9f7f 100644 --- a/boilerplate/cairo-boilerplate-win32-private.h +++ b/boilerplate/cairo-boilerplate-win32-private.h @@ -30,10 +30,10 @@ cairo_surface_t * _cairo_boilerplate_win32_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -41,10 +41,10 @@ _cairo_boilerplate_win32_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_win32_printing_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-win32.c b/boilerplate/cairo-boilerplate-win32.c index 4b54a54e..83bc7c29 100644 --- a/boilerplate/cairo-boilerplate-win32.c +++ b/boilerplate/cairo-boilerplate-win32.c @@ -32,10 +32,10 @@ cairo_surface_t * _cairo_boilerplate_win32_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-xcb-private.h b/boilerplate/cairo-boilerplate-xcb-private.h index 998e6b9c..969b7614 100644 --- a/boilerplate/cairo-boilerplate-xcb-private.h +++ b/boilerplate/cairo-boilerplate-xcb-private.h @@ -30,10 +30,10 @@ cairo_surface_t * _cairo_boilerplate_xcb_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c index 306f874a..23e1b5ad 100644 --- a/boilerplate/cairo-boilerplate-xcb.c +++ b/boilerplate/cairo-boilerplate-xcb.c @@ -50,10 +50,10 @@ _cairo_boilerplate_xcb_synchronize (void *closure) cairo_surface_t * _cairo_boilerplate_xcb_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) diff --git a/boilerplate/cairo-boilerplate-xlib-private.h b/boilerplate/cairo-boilerplate-xlib-private.h index 265ee97c..e4f24ce1 100644 --- a/boilerplate/cairo-boilerplate-xlib-private.h +++ b/boilerplate/cairo-boilerplate-xlib-private.h @@ -31,10 +31,10 @@ cairo_surface_t * _cairo_boilerplate_xlib_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -43,10 +43,10 @@ _cairo_boilerplate_xlib_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_xlib_reference_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -54,10 +54,10 @@ _cairo_boilerplate_xlib_reference_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_xlib_fallback_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c index 03febe90..f40f9271 100644 --- a/boilerplate/cairo-boilerplate-xlib.c +++ b/boilerplate/cairo-boilerplate-xlib.c @@ -188,10 +188,10 @@ _cairo_boilerplate_xlib_perf_create_surface (Display *dpy, cairo_surface_t * _cairo_boilerplate_xlib_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -202,9 +202,12 @@ _cairo_boilerplate_xlib_create_surface (const char *name, *closure = xtc = xcalloc (1, sizeof (xlib_target_closure_t)); - if (width == 0) + width = ceil (width); + if (width < 1) width = 1; - if (height == 0) + + height = ceil (height); + if (height < 1) height = 1; xtc->dpy = dpy = XOpenDisplay (NULL); @@ -228,10 +231,10 @@ _cairo_boilerplate_xlib_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_xlib_reference_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -253,9 +256,12 @@ _cairo_boilerplate_xlib_reference_create_surface (const char *name, *closure = xtc = xcalloc (1, sizeof (xlib_target_closure_t)); - if (width == 0) + width = ceil (width); + if (width < 1) width = 1; - if (height == 0) + + height = ceil (height); + if (height < 1) height = 1; xtc->dpy = dpy = XOpenDisplay (display); @@ -289,10 +295,10 @@ _cairo_boilerplate_xlib_reference_create_surface (const char *name, cairo_surface_t * _cairo_boilerplate_xlib_fallback_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -316,9 +322,12 @@ _cairo_boilerplate_xlib_fallback_create_surface (const char *name, *closure = xtc = xmalloc (sizeof (xlib_target_closure_t)); - if (width == 0) + width = ceil (width); + if (width < 1) width = 1; - if (height == 0) + + height = ceil (height); + if (height < 1) height = 1; xtc->dpy = dpy = XOpenDisplay (NULL); diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index 39a1a4a9..0ab45ee0 100644 --- a/boilerplate/cairo-boilerplate.c +++ b/boilerplate/cairo-boilerplate.c @@ -141,10 +141,10 @@ cairo_boilerplate_format_from_content (cairo_content_t content) static cairo_surface_t * _cairo_boilerplate_image_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -162,7 +162,7 @@ _cairo_boilerplate_image_create_surface (const char *name, return NULL; } - return cairo_image_surface_create (format, width, height); + return cairo_image_surface_create (format, ceil (width), ceil (height)); } cairo_surface_t * diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h index 99dc5ceb..626ee2eb 100644 --- a/boilerplate/cairo-boilerplate.h +++ b/boilerplate/cairo-boilerplate.h @@ -116,10 +116,10 @@ typedef enum { typedef cairo_surface_t * (*cairo_boilerplate_create_surface_t) (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); diff --git a/test/Makefile.am b/test/Makefile.am index 8df6c8eb..82417c43 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -502,6 +502,13 @@ REFERENCE_IMAGES = \ gradient-zero-stops.rgb24.ref.png \ group-clip.ref.png \ group-paint.ref.png \ + group-unaligned.ref.png \ + group-unaligned.pdf.ref.png \ + group-unaligned.ps.ref.png \ + group-unaligned.svg.argb32.ref.png \ + group-unaligned.svg.rgb24.ref.png \ + group-unaligned.xlib.ref.png \ + group-unaligned.xlib-fallback.ref.png \ huge-linear.ps3.ref.png \ huge-linear.ref.png \ huge-radial.ps3.ref.png \ diff --git a/test/Makefile.sources b/test/Makefile.sources index 64c6d043..e37b3e81 100644 --- a/test/Makefile.sources +++ b/test/Makefile.sources @@ -81,6 +81,7 @@ test_sources = \ gradient-zero-stops.c \ group-clip.c \ group-paint.c \ + group-unaligned.c \ huge-linear.c \ huge-radial.c \ image-surface-source.c \ diff --git a/test/cairo-test.c b/test/cairo-test.c index 715210f9..45b644b5 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -663,7 +663,7 @@ cairo_test_for_target (cairo_test_context_t *ctx, cairo_bool_t have_output = FALSE; cairo_bool_t have_result = FALSE; void *closure; - int width, height; + double width, height; cairo_bool_t have_output_dir; #if HAVE_MEMFAULT int malloc_failure_iterations = ctx->malloc_failure; diff --git a/test/cairo-test.h b/test/cairo-test.h index b16f340c..d644d96b 100644 --- a/test/cairo-test.h +++ b/test/cairo-test.h @@ -101,8 +101,8 @@ struct _cairo_test { const char *description; const char *keywords; const char *requirements; - int width; - int height; + double width; + double height; cairo_test_preamble_function_t *preamble; cairo_test_draw_function_t *draw; }; diff --git a/test/group-unaligned.c b/test/group-unaligned.c new file mode 100644 index 00000000..9124a032 --- /dev/null +++ b/test/group-unaligned.c @@ -0,0 +1,60 @@ +/* + * Copyright © Chris Wilson, 2008 + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Chris Wilson not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL CHRIS WILSON BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Chris Wilson <chris@chris-wilson.co.uk> + * Stefan Röllin <stefan.roellin@gmx.ch> + */ + +#include "cairo-test.h" + +static void +circle (cairo_t* cr, double xc, double yc, double radius) +{ + cairo_arc (cr, xc, yc, radius, 0.0, 2*M_PI); +} + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_set_source_rgb (cr, 1, 1, 1); + cairo_paint (cr); + + cairo_set_source_rgb (cr, 1, 0, 0); + circle (cr, 12.5, 12.5, 10.); + cairo_fill (cr); + + cairo_push_group (cr); + cairo_set_source_rgb (cr, 0, 0, 1); + circle (cr, 12.5, 12.5, 10.); + cairo_fill (cr); + cairo_pop_group_to_source (cr); + cairo_paint (cr); + + return CAIRO_TEST_SUCCESS; +} + +CAIRO_TEST (group_unaligned, + "test non-integer sized sub-surface", + "group", /* keywords */ + NULL, /* requirements */ + 35.5, 35.5, + NULL, draw) diff --git a/test/group-unaligned.pdf.ref.png b/test/group-unaligned.pdf.ref.png Binary files differnew file mode 100644 index 00000000..0eb39c0e --- /dev/null +++ b/test/group-unaligned.pdf.ref.png diff --git a/test/group-unaligned.ps.ref.png b/test/group-unaligned.ps.ref.png Binary files differnew file mode 100644 index 00000000..79525ac5 --- /dev/null +++ b/test/group-unaligned.ps.ref.png diff --git a/test/group-unaligned.svg.argb32.ref.png b/test/group-unaligned.svg.argb32.ref.png Binary files differnew file mode 100644 index 00000000..91535f97 --- /dev/null +++ b/test/group-unaligned.svg.argb32.ref.png diff --git a/test/group-unaligned.svg.rgb24.ref.png b/test/group-unaligned.svg.rgb24.ref.png Binary files differnew file mode 100644 index 00000000..42558a6e --- /dev/null +++ b/test/group-unaligned.svg.rgb24.ref.png diff --git a/test/group-unaligned.xlib-fallback.ref.png b/test/group-unaligned.xlib-fallback.ref.png Binary files differnew file mode 100644 index 00000000..ed615b22 --- /dev/null +++ b/test/group-unaligned.xlib-fallback.ref.png diff --git a/test/group-unaligned.xlib.ref.png b/test/group-unaligned.xlib.ref.png Binary files differnew file mode 100644 index 00000000..c62aa5af --- /dev/null +++ b/test/group-unaligned.xlib.ref.png |