[cairo-commit] 2 commits - boilerplate/cairo-boilerplate-glx.c src/cairo-ft-font.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Jun 29 02:34:25 PDT 2012


 boilerplate/cairo-boilerplate-glx.c |   23 ++++++++++++++---------
 src/cairo-ft-font.c                 |   14 +++++++-------
 2 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit 64d65f72e5dbc1d9fa2cb4738d93eadc7fd5d7c0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jun 29 10:25:13 2012 +0100

    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 at chris-wilson.co.uk>

diff --git a/boilerplate/cairo-boilerplate-glx.c b/boilerplate/cairo-boilerplate-glx.c
index 35e8192..28026dc 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)
commit cb85631c63539f259d6a3c1c04db904cbbf01d93
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jun 25 14:07:33 2012 +0100

    ft: Indentation fixup for _get_bitmap_surface()
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index fba8025..f9fcfae 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1158,8 +1158,8 @@ _get_bitmap_surface (FT_Bitmap		     *bitmap,
 
 #ifndef WORDS_BIGENDIAN
 	{
-	    uint8_t   *d = data;
-	    int		count = stride * height;
+	    uint8_t *d = data;
+	    int count = stride * height;
 
 	    while (count--) {
 		*d = CAIRO_BITSWAP8 (*d);
@@ -1173,7 +1173,7 @@ _get_bitmap_surface (FT_Bitmap		     *bitmap,
     case FT_PIXEL_MODE_LCD:
     case FT_PIXEL_MODE_LCD_V:
     case FT_PIXEL_MODE_GRAY:
-        if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) {
+	if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) {
 	    stride = bitmap->pitch;
 	    if (own_buffer) {
 		data = bitmap->buffer;
@@ -1185,7 +1185,7 @@ _get_bitmap_surface (FT_Bitmap		     *bitmap,
 		memcpy (data, bitmap->buffer, stride * height);
 	    }
 
-	format = CAIRO_FORMAT_A8;
+	    format = CAIRO_FORMAT_A8;
 	} else {
 	    /* if we get there, the  data from the source bitmap
 	     * really comes from _fill_xrender_bitmap, and is
@@ -1193,9 +1193,9 @@ _get_bitmap_surface (FT_Bitmap		     *bitmap,
 	    assert (own_buffer != 0);
 	    assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY);
 
-		data = bitmap->buffer;
-		stride = bitmap->pitch;
-		format = CAIRO_FORMAT_ARGB32;
+	    data = bitmap->buffer;
+	    stride = bitmap->pitch;
+	    format = CAIRO_FORMAT_ARGB32;
 	}
 	break;
     case FT_PIXEL_MODE_GRAY2:


More information about the cairo-commit mailing list