[cairo-commit] cairo/src cairo_ps_surface.c,1.19,1.20

Owen Taylor commit at pdx.freedesktop.org
Sun Jan 30 11:37:50 PST 2005


Committed by: otaylor

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

Modified Files:
	cairo_ps_surface.c 
Log Message:
2005-01-30  Owen Taylor  <otaylor at redhat.com>

        * src/cairo_ps_surface.c (_cairo_ps_surface_copy_page): Update
        composite-over-white code to use a pattern, not a surface.
        (to match _cairo_surface_composite API change.)


Index: cairo_ps_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ps_surface.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cairo_ps_surface.c	27 Jan 2005 23:46:17 -0000	1.19
+++ cairo_ps_surface.c	30 Jan 2005 19:37:48 -0000	1.20
@@ -314,12 +314,10 @@
 
     int i, x, y;
 
-    cairo_surface_t *white_surface;
+    cairo_pattern_t white_pattern;
     char *rgb, *compressed;
     long rgb_size, compressed_size;
 
-    cairo_color_t white;
-
     rgb_size = 3 * width * height;
     rgb = malloc (rgb_size);
     if (rgb == NULL) {
@@ -336,26 +334,19 @@
 
     /* PostScript can not represent the alpha channel, so we blend the
        current image over a white RGB surface to eliminate it. */
-    white_surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
-    if (white_surface == NULL) {
-	status = CAIRO_STATUS_NO_MEMORY;
-	goto BAIL2;
-    }
 
-    _cairo_color_init (&white);
-    _cairo_surface_fill_rectangle (white_surface,
-				   CAIRO_OPERATOR_SRC,
-				   &white,
-				   0, 0, 1, 1);
-    cairo_surface_set_repeat (white_surface, 1);
+    _cairo_pattern_init_solid (&white_pattern, 1.0, 1.0, 1.0);
+
     _cairo_surface_composite (CAIRO_OPERATOR_OVER_REVERSE,
-			      white_surface,
+			      &white_pattern,
 			      NULL,
 			      &surface->image->base,
 			      0, 0,
 			      0, 0,
 			      0, 0,
 			      width, height);
+    
+    _cairo_pattern_fini (&white_pattern);
 
     i = 0;
     for (y = 0; y < height; y++) {
@@ -399,8 +390,6 @@
     /* Page footer */
     fprintf (file, "%%%%EndPage\n");
 
-    cairo_surface_destroy (white_surface);
-    BAIL2:
     free (compressed);
     BAIL1:
     free (rgb);




More information about the cairo-commit mailing list