[cairo-commit] cairo/src cairo_win32_font.c, 1.8, 1.9 cairo_win32_surface.c, 1.8, 1.9

Owen Taylor commit at pdx.freedesktop.org
Fri Mar 4 10:43:26 PST 2005


Committed by: otaylor

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv5313/src

Modified Files:
	cairo_win32_font.c cairo_win32_surface.c 
Log Message:
2005-03-04  Owen Taylor  <otaylor at redhat.com>

	* src/cairo_win32_font.c src/cairo_win32_surface.c: Update
	for recent backend interface changes.

	* configure.in: Reenable win32 backend by default.

Index: cairo_win32_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_win32_font.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cairo_win32_font.c	6 Feb 2005 20:00:28 -0000	1.8
+++ cairo_win32_font.c	4 Mar 2005 18:43:24 -0000	1.9
@@ -1010,16 +1010,18 @@
 	surface->format == CAIRO_FORMAT_RGB24 &&
 	operator == CAIRO_OPERATOR_OVER &&
 	pattern->type == CAIRO_PATTERN_SOLID &&
-	(pattern->color.alpha_short >> 8) == 255) {
+	_cairo_pattern_is_opaque (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 (pattern->color.red_short >> 8,
-			 pattern->color.green_short >> 8,
-			 pattern->color.blue_short >> 8);
+	new_color = RGB (((int)(0xffff * solid_pattern->red)) >> 8,
+			 ((int)(0xffff * solid_pattern->green)) >> 8,
+			 ((int)(0xffff * solid_pattern->blue)) >> 8);
 
 	status = _draw_glyphs_on_surface (surface, font, new_color,
 					  0, 0,
@@ -1035,6 +1037,7 @@
 	 */
 	cairo_win32_surface_t *tmp_surface;
 	cairo_surface_t *mask_surface;
+	cairo_surface_pattern_t mask;
 	RECT r;
 
 	tmp_surface = (cairo_win32_surface_t *)_cairo_win32_surface_create_dib (CAIRO_FORMAT_ARGB32, width, height);
@@ -1079,13 +1082,17 @@
 	 * draw onto an intermediate ARGB32 surface and alpha-blend that with the
 	 * destination
 	 */
+	_cairo_pattern_init_for_surface (&mask, mask_surface);
+
 	status = _cairo_surface_composite (operator, pattern, 
-					   mask_surface,
+					   &mask.base,
 					   &surface->base,
 					   source_x, source_y,
 					   0, 0,
 					   dest_x, dest_y,
 					   width, height);
+
+	_cairo_pattern_fini (&mask.base);
 	
 	cairo_surface_destroy (mask_surface);
 

Index: cairo_win32_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_win32_surface.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cairo_win32_surface.c	4 Mar 2005 17:41:34 -0000	1.8
+++ cairo_win32_surface.c	4 Mar 2005 18:43:24 -0000	1.9
@@ -552,46 +552,10 @@
     return CAIRO_INT_STATUS_UNSUPPORTED;
 }
 
-static cairo_status_t
-_cairo_win32_surface_set_matrix (void           *abstract_surface, 
-				 cairo_matrix_t *matrix)
-{
-    cairo_win32_surface_t *surface = abstract_surface;
-
-    if (surface->image)
-	cairo_surface_set_matrix (surface->image, matrix);
-
-    return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_status_t
-_cairo_win32_surface_set_filter (void           *abstract_surface, 
-				 cairo_filter_t  filter)
-{
-    cairo_win32_surface_t *surface = abstract_surface;
-
-    if (surface->image)
-	cairo_surface_set_filter (surface->image, filter);
-
-    return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_status_t
-_cairo_win32_surface_set_repeat (void *abstract_surface, 
-				 int   repeat)
-{
-    cairo_win32_surface_t *surface = abstract_surface;
-
-    if (surface->image)
-	cairo_surface_set_repeat (surface->image, repeat);
-
-    return CAIRO_STATUS_SUCCESS;
-}
-
 static cairo_int_status_t
 _cairo_win32_surface_composite (cairo_operator_t	operator,
 				cairo_pattern_t       	*pattern,
-			       cairo_pattern_t		*mask_pattern,
+				cairo_pattern_t		*mask_pattern,
 				void			*abstract_dst,
 				int			src_x,
 				int			src_y,
@@ -604,25 +568,37 @@
 {
     cairo_win32_surface_t *dst = abstract_dst;
     cairo_win32_surface_t *src;
-    cairo_win32_surface_t *mask;
+    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 ||
-	pattern->u.surface.surface->backend != dst->base.backend ||
-	mask)
+	pattern->extend != CAIRO_EXTEND_NONE)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
-    src = (cairo_win32_surface_t *)pattern->u.surface.surface;
+    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)
+	return CAIRO_INT_STATUS_UNSUPPORTED;
     
     integer_transform = _cairo_matrix_is_integer_translation (&pattern->matrix, &itx, &ity);
     if (!integer_transform)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
-    alpha = (pattern->color.alpha_short) >> 8;
-
     if (alpha == 255 &&
 	src->format == dst->format &&
 	(operator == CAIRO_OPERATOR_SRC ||
@@ -945,9 +921,6 @@
     _cairo_win32_surface_acquire_dest_image,
     _cairo_win32_surface_release_dest_image,
     _cairo_win32_surface_clone_similar,
-    _cairo_win32_surface_set_matrix,
-    _cairo_win32_surface_set_filter,
-    _cairo_win32_surface_set_repeat,
     _cairo_win32_surface_composite,
     _cairo_win32_surface_fill_rectangles,
     _cairo_win32_surface_composite_trapezoids,




More information about the cairo-commit mailing list