[cairo] State of Win32 backend?

Tor Lillqvist tml at iki.fi
Wed May 4 01:33:39 PDT 2005


Hi,

Cairo HEAD has for some time not built on Win32. The below makes it
build, but I can't really say whether this is correct or not.

--tml

Index: src/cairo-win32-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-font.c,v
retrieving revision 1.16
diff -p -u -4 -r1.16 cairo-win32-font.c
--- src/cairo-win32-font.c	8 Apr 2005 20:14:17 -0000	1.16
+++ src/cairo-win32-font.c	4 May 2005 07:30:24 -0000
@@ -1002,20 +1002,21 @@ _cairo_win32_scaled_font_show_glyphs (vo
     if (_cairo_surface_is_win32 (generic_surface) &&
 	surface->format == CAIRO_FORMAT_RGB24 &&
 	operator == CAIRO_OPERATOR_OVER &&
 	pattern->type == CAIRO_PATTERN_SOLID &&
-	_cairo_pattern_is_opaque (pattern)) {
+	_cairo_pattern_is_opaque_solid (pattern)) {
 
 	cairo_solid_pattern_t *solid_pattern = (cairo_solid_pattern_t *)pattern;
 
 	/* When compositing OVER on a GDI-understood surface, with a
 	 * solid opaque color, we can just call ExtTextOut directly.
 	 */
 	COLORREF new_color;
 	
-	new_color = RGB (((int)(0xffff * solid_pattern->red)) >> 8,
-			 ((int)(0xffff * solid_pattern->green)) >> 8,
-			 ((int)(0xffff * solid_pattern->blue)) >> 8);
+	/* XXX Use the unpremultiplied or premultiplied color? */
+	new_color = RGB (((int)(0xffff * solid_pattern->color.red_short)) >> 8,
+			 ((int)(0xffff * solid_pattern->color.green_short)) >> 8,
+			 ((int)(0xffff * solid_pattern->color.blue_short)) >> 8);
 
 	status = _draw_glyphs_on_surface (surface, scaled_font, new_color,
 					  0, 0,
 					  glyphs, num_glyphs);
Index: src/cairo-win32-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-surface.c,v
retrieving revision 1.19
diff -p -u -4 -r1.19 cairo-win32-surface.c
--- src/cairo-win32-surface.c	26 Apr 2005 02:38:44 -0000	1.19
+++ src/cairo-win32-surface.c	4 May 2005 07:30:25 -0000
@@ -532,28 +532,15 @@ _cairo_win32_surface_composite (cairo_op
 {
     cairo_win32_surface_t *dst = abstract_dst;
     cairo_win32_surface_t *src;
     cairo_surface_pattern_t *src_surface_pattern;
-    int alpha;
     int integer_transform;
     int itx, ity;
 
     if (pattern->type != CAIRO_PATTERN_SURFACE ||
 	pattern->extend != CAIRO_EXTEND_NONE)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
-    if (mask_pattern) {
-	/* FIXME: When we fully support RENDER style 4-channel
-	 * masks we need to check r/g/b != 1.0.
-	 */
-	if (mask_pattern->type != CAIRO_PATTERN_SOLID)
-	    return CAIRO_INT_STATUS_UNSUPPORTED;
-
-	alpha = (int)(0xffff * pattern->alpha * mask_pattern->alpha) >> 8; 
-    } else {
-	alpha = (int)(0xffff * pattern->alpha) >> 8;
-    }
-
     src_surface_pattern = (cairo_surface_pattern_t *)pattern;
     src = (cairo_win32_surface_t *)src_surface_pattern->surface;
 
     if (src->base.backend != dst->base.backend)
@@ -562,34 +549,19 @@ _cairo_win32_surface_composite (cairo_op
     integer_transform = _cairo_matrix_is_integer_translation (&pattern->matrix, &itx, &ity);
     if (!integer_transform)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
-    if (alpha == 255 &&
-	src->format == dst->format &&
-	(operator == CAIRO_OPERATOR_SRC ||
-	 (src->format == CAIRO_FORMAT_RGB24 && operator == CAIRO_OPERATOR_OVER))) {
-	
-	if (!BitBlt (dst->dc,
-		     dst_x, dst_y,
-		     width, height,
-		     src->dc,
-		     src_x + itx, src_y + ity,
-		     SRCCOPY))
-	    return _cairo_win32_print_gdi_error ("_cairo_win32_surface_composite");
-
-	return CAIRO_STATUS_SUCCESS;
-	
-    } else if (integer_transform &&
-	       (src->format == CAIRO_FORMAT_RGB24 || src->format == CAIRO_FORMAT_ARGB32) &&
-	       dst->format == CAIRO_FORMAT_RGB24 &&
-	       !src->base.repeat &&
-	       operator == CAIRO_OPERATOR_OVER) {
+    if (integer_transform &&
+	(src->format == CAIRO_FORMAT_RGB24 || src->format == CAIRO_FORMAT_ARGB32) &&
+	dst->format == CAIRO_FORMAT_RGB24 &&
+	!src->base.repeat &&
+	operator == CAIRO_OPERATOR_OVER) {
 
 	BLENDFUNCTION blend_function;
 
 	blend_function.BlendOp = AC_SRC_OVER;
 	blend_function.BlendFlags = 0;
-	blend_function.SourceConstantAlpha = alpha;
+	blend_function.SourceConstantAlpha = 255;
 	blend_function.AlphaFormat = src->format == CAIRO_FORMAT_ARGB32 ? AC_SRC_ALPHA : 0;
 
 	if (!AlphaBlend (dst->dc,
 			 dst_x, dst_y,
@@ -780,11 +752,12 @@ _cairo_win32_surface_set_clip_region (vo
     }
 }
 
 static cairo_int_status_t
-_cairo_win32_get_extents (void		    *abstract_surface,
-			  cairo_rectangle_t *rectangle)
+_cairo_win32_surface_get_extents (void		    *abstract_surface,
+				  cairo_rectangle_t *rectangle)
 {
+    cairo_win32_surface_t *surface = abstract_surface;
     RECT clip_box;
 
     if (GetClipBox (surface->dc, &clip_box) == ERROR)
 	return _cairo_win32_print_gdi_error ("_cairo_win3_surface_acquire_dest_image");





More information about the cairo mailing list