summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-29 10:25:13 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-29 10:33:08 +0100
commit64d65f72e5dbc1d9fa2cb4738d93eadc7fd5d7c0 (patch)
tree11cd507edcc12f710a0496d6a05ecb6b3adecbb8 /boilerplate
parentcb85631c63539f259d6a3c1c04db904cbbf01d93 (diff)
boilerplate/gl: Round fractional window sizes up
A few test cases purposely create fractional surface sizes which can not be natively supported by the raster backends such as GL. For these backends we need to consistent in creating a surface that is large enough to contain the test, so we need to use ceil() rather than implicit truncation to integers. A consequence of the misalignment between the Window size and the surface size (where one was using ceil and the other not) is that the first row of the cairo surface would not be visible on the output. Based on a patch by Chuanbo Wen to fix 5 test cases, such as group-unaligned. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-glx.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/boilerplate/cairo-boilerplate-glx.c b/boilerplate/cairo-boilerplate-glx.c
index 35e819244..28026dccc 100644
--- a/boilerplate/cairo-boilerplate-glx.c
+++ b/boilerplate/cairo-boilerplate-glx.c
@@ -98,6 +98,9 @@ _cairo_boilerplate_gl_create_surface (const char *name,
gltc = calloc (1, sizeof (gl_target_closure_t));
*closure = gltc;
+ width = ceil (width);
+ height = ceil (height);
+
if (width == 0)
width = 1;
if (height == 0)
@@ -133,9 +136,7 @@ _cairo_boilerplate_gl_create_surface (const char *name,
gltc->device = cairo_glx_device_create (dpy, ctx);
gltc->surface = surface = cairo_gl_surface_create (gltc->device,
- content,
- ceil (width),
- ceil (height));
+ content, width, height);
if (cairo_surface_status (surface))
_cairo_boilerplate_gl_cleanup (gltc);
@@ -143,7 +144,7 @@ _cairo_boilerplate_gl_create_surface (const char *name,
}
static cairo_surface_t *
-_cairo_boilerplate_gl_create_window (const char *name,
+_cairo_boilerplate_gl_create_window (const char *name,
cairo_content_t content,
double width,
double height,
@@ -169,6 +170,9 @@ _cairo_boilerplate_gl_create_window (const char *name,
gltc = calloc (1, sizeof (gl_target_closure_t));
*closure = gltc;
+ width = ceil (width);
+ height = ceil (height);
+
if (width == 0)
width = 1;
if (height == 0)
@@ -214,8 +218,7 @@ _cairo_boilerplate_gl_create_window (const char *name,
gltc->surface = surface = cairo_gl_surface_create_for_window (gltc->device,
gltc->drawable,
- ceil (width),
- ceil (height));
+ width, height);
if (cairo_surface_status (surface))
_cairo_boilerplate_gl_cleanup (gltc);
@@ -224,7 +227,7 @@ _cairo_boilerplate_gl_create_window (const char *name,
static cairo_surface_t *
_cairo_boilerplate_gl_create_window_db (const char *name,
- cairo_content_t content,
+ cairo_content_t content,
double width,
double height,
double max_width,
@@ -250,6 +253,9 @@ _cairo_boilerplate_gl_create_window_db (const char *name,
gltc = calloc (1, sizeof (gl_target_closure_t));
*closure = gltc;
+ width = ceil (width);
+ height = ceil (height);
+
if (width == 0)
width = 1;
if (height == 0)
@@ -295,8 +301,7 @@ _cairo_boilerplate_gl_create_window_db (const char *name,
gltc->surface = cairo_gl_surface_create_for_window (gltc->device,
gltc->drawable,
- ceil (width),
- ceil (height));
+ width, height);
surface = cairo_surface_create_similar (gltc->surface, content, width, height);
status = cairo_surface_set_user_data (surface, &gl_closure_key, gltc, NULL);
if (status == CAIRO_STATUS_SUCCESS)