[cairo] State of Win32 backend?

Tor Lillqvist tml at iki.fi
Thu May 5 16:02:46 PDT 2005


Owen Taylor writes:
 > No, this isn't right. You'll compute 0xffff * 0xffff >> 8. The 
 > "0xffff *" isn't needed when you are using red_short.

OK, should have used my brain ;-)

 > Don't understand why you removed this. 

I guess I thought that as the alpha wasn't longer where it used to be,
that it wasn't necessary, or something... 

So, the current diff would then be this simple:

Index: src/cairo-win32-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-font.c,v
retrieving revision 1.16
diff -u -2 -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	5 May 2005 22:50:17 -0000
@@ -1003,6 +1003,5 @@
 	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;
@@ -1013,7 +1012,8 @@
 	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)solid_pattern->color.red_short) >> 8,
+			 ((int)solid_pattern->color.green_short) >> 8,
+			 ((int)solid_pattern->color.blue_short) >> 8);
 
 	status = _draw_glyphs_on_surface (surface, scaled_font, new_color,
Index: src/cairo-win32-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-surface.c,v
retrieving revision 1.19
diff -u -2 -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	5 May 2005 22:50:17 -0000
@@ -549,7 +549,7 @@
 	    return CAIRO_INT_STATUS_UNSUPPORTED;
 
-	alpha = (int)(0xffff * pattern->alpha * mask_pattern->alpha) >> 8; 
+	alpha = ((cairo_solid_pattern_t *)mask_pattern)->color.alpha_short >> 8;
     } else {
-	alpha = (int)(0xffff * pattern->alpha) >> 8;
+        alpha = 255;
     }
 
@@ -782,7 +782,8 @@
 
 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;
 

--tml




More information about the cairo mailing list