summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-06-27 17:53:18 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-06-27 17:53:18 +0100
commit86624627e4b196a78cfd9bd642299441e838e0f2 (patch)
tree49edd056650918b296654c4b1db402ea9142b80f
parentc506ddb58612c69b80b08be3a6d14c5bcc1ac21f (diff)
downloadcairo-86624627e4b196a78cfd9bd642299441e838e0f2.tar.gz
[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.
-rw-r--r--boilerplate/cairo-boilerplate-beos-private.h16
-rw-r--r--boilerplate/cairo-boilerplate-beos.cpp8
-rw-r--r--boilerplate/cairo-boilerplate-directfb-private.h8
-rw-r--r--boilerplate/cairo-boilerplate-directfb.c8
-rw-r--r--boilerplate/cairo-boilerplate-glitz-agl.c8
-rw-r--r--boilerplate/cairo-boilerplate-glitz-glx.c10
-rw-r--r--boilerplate/cairo-boilerplate-glitz-private.h24
-rw-r--r--boilerplate/cairo-boilerplate-glitz-wgl.c8
-rw-r--r--boilerplate/cairo-boilerplate-pdf-private.h8
-rw-r--r--boilerplate/cairo-boilerplate-pdf.c14
-rw-r--r--boilerplate/cairo-boilerplate-ps-private.h16
-rw-r--r--boilerplate/cairo-boilerplate-ps.c30
-rw-r--r--boilerplate/cairo-boilerplate-qt-private.h10
-rw-r--r--boilerplate/cairo-boilerplate-qt.cpp8
-rw-r--r--boilerplate/cairo-boilerplate-quartz-private.h8
-rw-r--r--boilerplate/cairo-boilerplate-quartz.c8
-rw-r--r--boilerplate/cairo-boilerplate-script-private.h8
-rw-r--r--boilerplate/cairo-boilerplate-script.c12
-rw-r--r--boilerplate/cairo-boilerplate-svg-private.h16
-rw-r--r--boilerplate/cairo-boilerplate-svg.c30
-rw-r--r--boilerplate/cairo-boilerplate-test-surfaces-private.h40
-rw-r--r--boilerplate/cairo-boilerplate-test-surfaces.c40
-rw-r--r--boilerplate/cairo-boilerplate-win32-printing.c8
-rw-r--r--boilerplate/cairo-boilerplate-win32-private.h16
-rw-r--r--boilerplate/cairo-boilerplate-win32.c8
-rw-r--r--boilerplate/cairo-boilerplate-xcb-private.h8
-rw-r--r--boilerplate/cairo-boilerplate-xcb.c8
-rw-r--r--boilerplate/cairo-boilerplate-xlib-private.h24
-rw-r--r--boilerplate/cairo-boilerplate-xlib.c45
-rw-r--r--boilerplate/cairo-boilerplate.c10
-rw-r--r--boilerplate/cairo-boilerplate.h8
-rw-r--r--test/Makefile.am7
-rw-r--r--test/Makefile.sources1
-rw-r--r--test/cairo-test.c2
-rw-r--r--test/cairo-test.h4
-rw-r--r--test/group-unaligned.c60
-rw-r--r--test/group-unaligned.pdf.ref.pngbin0 -> 414 bytes
-rw-r--r--test/group-unaligned.ps.ref.pngbin0 -> 332 bytes
-rw-r--r--test/group-unaligned.svg.argb32.ref.pngbin0 -> 524 bytes
-rw-r--r--test/group-unaligned.svg.rgb24.ref.pngbin0 -> 434 bytes
-rw-r--r--test/group-unaligned.xlib-fallback.ref.pngbin0 -> 496 bytes
-rw-r--r--test/group-unaligned.xlib.ref.pngbin0 -> 466 bytes
42 files changed, 312 insertions, 235 deletions
diff --git a/boilerplate/cairo-boilerplate-beos-private.h b/boilerplate/cairo-boilerplate-beos-private.h
index 1d800c269..4505d7389 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 497d92778..f5276276a 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 87d1b8b06..a34edcba1 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 7a6462f6f..ea7a8ad90 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 dd10a00ed..03d0423b9 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 4c26b8778..a1981ebfe 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 052c7e061..62904c7c9 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 dfd764f67..9cd11b600 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 3c34c3eff..f4affe765 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 c3289f8fb..3ac380c2e 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 b97c7db94..7bcce1c04 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 c3efceab5..2fb03e893 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 4ac876426..917d63b46 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 0e0aa7db6..addcb12eb 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 573e247e0..ccf8a9acb 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 30652131d..0b5b49d52 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 480e4221a..ad01d6293 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 ae08cbc5d..3d78078c0 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 d8c0a8fb7..5a64eaf08 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 e6c1355fc..407214c76 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 55134fe54..57bf62ddf 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 0fc92e3f8..0fec39330 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 13a65515c..7a6dafc96 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 fc039ae76..b09b9f7f5 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 4b54a54e5..83bc7c29c 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 998e6b9ca..969b76149 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 306f874ac..23e1b5ad9 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 265ee97cc..e4f24ce16 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 03febe90e..f40f92713 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 39a1a4a92..0ab45ee02 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 99dc5ceb8..626ee2eb5 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 8df6c8eb9..82417c432 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 64c6d043d..e37b3e811 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 715210f96..45b644b53 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 b16f340cf..d644d96b2 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 000000000..9124a032c
--- /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
new file mode 100644
index 000000000..0eb39c0e4
--- /dev/null
+++ b/test/group-unaligned.pdf.ref.png
Binary files differ
diff --git a/test/group-unaligned.ps.ref.png b/test/group-unaligned.ps.ref.png
new file mode 100644
index 000000000..79525ac58
--- /dev/null
+++ b/test/group-unaligned.ps.ref.png
Binary files differ
diff --git a/test/group-unaligned.svg.argb32.ref.png b/test/group-unaligned.svg.argb32.ref.png
new file mode 100644
index 000000000..91535f976
--- /dev/null
+++ b/test/group-unaligned.svg.argb32.ref.png
Binary files differ
diff --git a/test/group-unaligned.svg.rgb24.ref.png b/test/group-unaligned.svg.rgb24.ref.png
new file mode 100644
index 000000000..42558a6e0
--- /dev/null
+++ b/test/group-unaligned.svg.rgb24.ref.png
Binary files differ
diff --git a/test/group-unaligned.xlib-fallback.ref.png b/test/group-unaligned.xlib-fallback.ref.png
new file mode 100644
index 000000000..ed615b228
--- /dev/null
+++ b/test/group-unaligned.xlib-fallback.ref.png
Binary files differ
diff --git a/test/group-unaligned.xlib.ref.png b/test/group-unaligned.xlib.ref.png
new file mode 100644
index 000000000..c62aa5af5
--- /dev/null
+++ b/test/group-unaligned.xlib.ref.png
Binary files differ