[cairo-commit] 2 commits - src/cairo-image-surface.c src/cairoint.h src/cairo-meta-surface.c src/cairo-pattern.c

Carl Worth cworth at kemper.freedesktop.org
Wed Sep 10 14:56:24 PDT 2008


 src/cairo-image-surface.c |   10 ++++++++++
 src/cairo-meta-surface.c  |   38 ++++++--------------------------------
 src/cairo-pattern.c       |   30 ++++++++++++++++++++++++++++++
 src/cairoint.h            |    4 ++++
 4 files changed, 50 insertions(+), 32 deletions(-)

New commits:
commit e0b4f8dc8fd9861359f913dd69daa0ffeb66907a
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Aug 27 16:13:57 2008 -0700

    Avoid missing enum warnings with pixman 0.11.9

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 4225548..e0b19a7 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -60,6 +60,10 @@ _cairo_format_from_pixman_format (pixman_format_code_t pixman_format)
     case PIXMAN_a1r1g1b1: case PIXMAN_a1b1g1r1: case PIXMAN_c4:
     case PIXMAN_g4:       case PIXMAN_g1:
     case PIXMAN_yuy2:     case PIXMAN_yv12:
+#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,11,9)
+    case PIXMAN_x2b10g10r10:
+    case PIXMAN_a2b10g10r10:
+#endif
     default:
 	return CAIRO_FORMAT_INVALID;
     }
@@ -81,6 +85,9 @@ _cairo_content_from_pixman_format (pixman_format_code_t pixman_format)
     case PIXMAN_a2b2g2r2:
     case PIXMAN_a1r1g1b1:
     case PIXMAN_a1b1g1r1:
+#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,11,9)
+    case PIXMAN_a2b10g10r10:
+#endif
 	return CAIRO_CONTENT_COLOR_ALPHA;
     case PIXMAN_x8r8g8b8:
     case PIXMAN_x8b8g8r8:
@@ -103,6 +110,9 @@ _cairo_content_from_pixman_format (pixman_format_code_t pixman_format)
     case PIXMAN_g1:
     case PIXMAN_yuy2:
     case PIXMAN_yv12:
+#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,11,9)
+    case PIXMAN_x2b10g10r10:
+#endif
 	return CAIRO_CONTENT_COLOR;
     case PIXMAN_a8:
     case PIXMAN_a1:
commit bdcdc8400ef8c199eb7dea961ea13b75ae93176d
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Aug 27 15:54:15 2008 -0700

    Rename _init_pattern_with_snapshot to _cairo_pattern_init_snapshot

diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index ee52b49..d939efe 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -216,32 +216,6 @@ _cairo_meta_surface_release_source_image (void			*abstract_surface,
     cairo_surface_destroy (&image->base);
 }
 
-static cairo_status_t
-_init_pattern_with_snapshot (cairo_pattern_t       *pattern,
-			     const cairo_pattern_t *other)
-{
-    cairo_status_t status;
-
-    status = _cairo_pattern_init_copy (pattern, other);
-    if (status)
-	return status;
-
-    if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
-	cairo_surface_pattern_t *surface_pattern =
-	    (cairo_surface_pattern_t *) pattern;
-	cairo_surface_t *surface = surface_pattern->surface;
-
-	surface_pattern->surface = _cairo_surface_snapshot (surface);
-
-	cairo_surface_destroy (surface);
-
-	if (surface_pattern->surface->status)
-	    return surface_pattern->surface->status;
-    }
-
-    return CAIRO_STATUS_SUCCESS;
-}
-
 static cairo_int_status_t
 _cairo_meta_surface_paint (void			*abstract_surface,
 			   cairo_operator_t	 op,
@@ -259,7 +233,7 @@ _cairo_meta_surface_paint (void			*abstract_surface,
     command->header.region = CAIRO_META_REGION_ALL;
     command->op = op;
 
-    status = _init_pattern_with_snapshot (&command->source.base, source);
+    status = _cairo_pattern_init_snapshot (&command->source.base, source);
     if (status)
 	goto CLEANUP_COMMAND;
 
@@ -300,11 +274,11 @@ _cairo_meta_surface_mask (void			*abstract_surface,
     command->header.region = CAIRO_META_REGION_ALL;
     command->op = op;
 
-    status = _init_pattern_with_snapshot (&command->source.base, source);
+    status = _cairo_pattern_init_snapshot (&command->source.base, source);
     if (status)
 	goto CLEANUP_COMMAND;
 
-    status = _init_pattern_with_snapshot (&command->mask.base, mask);
+    status = _cairo_pattern_init_snapshot (&command->mask.base, mask);
     if (status)
 	goto CLEANUP_SOURCE;
 
@@ -346,7 +320,7 @@ _cairo_meta_surface_stroke (void			*abstract_surface,
     command->header.region = CAIRO_META_REGION_ALL;
     command->op = op;
 
-    status = _init_pattern_with_snapshot (&command->source.base, source);
+    status = _cairo_pattern_init_snapshot (&command->source.base, source);
     if (status)
 	goto CLEANUP_COMMAND;
 
@@ -401,7 +375,7 @@ _cairo_meta_surface_fill (void			*abstract_surface,
     command->header.region = CAIRO_META_REGION_ALL;
     command->op = op;
 
-    status = _init_pattern_with_snapshot (&command->source.base, source);
+    status = _cairo_pattern_init_snapshot (&command->source.base, source);
     if (status)
 	goto CLEANUP_COMMAND;
 
@@ -459,7 +433,7 @@ _cairo_meta_surface_show_text_glyphs (void			    *abstract_surface,
     command->header.region = CAIRO_META_REGION_ALL;
     command->op = op;
 
-    status = _init_pattern_with_snapshot (&command->source.base, source);
+    status = _cairo_pattern_init_snapshot (&command->source.base, source);
     if (status)
 	goto CLEANUP_COMMAND;
 
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 3dfd7c8..2b8771c 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -192,6 +192,36 @@ _cairo_pattern_init_copy (cairo_pattern_t	*pattern,
     return CAIRO_STATUS_SUCCESS;
 }
 
+cairo_status_t
+_cairo_pattern_init_snapshot (cairo_pattern_t       *pattern,
+			      const cairo_pattern_t *other)
+{
+    cairo_status_t status;
+
+    /* We don't bother doing any fancy copy-on-write implementation
+     * for the pattern's data. It's generally quite tiny. */
+    status = _cairo_pattern_init_copy (pattern, other);
+    if (status)
+	return status;
+
+    /* But we do let the surface snapshot stuff be as fancy as it
+     * would like to be. */
+    if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
+	cairo_surface_pattern_t *surface_pattern =
+	    (cairo_surface_pattern_t *) pattern;
+	cairo_surface_t *surface = surface_pattern->surface;
+
+	surface_pattern->surface = _cairo_surface_snapshot (surface);
+
+	cairo_surface_destroy (surface);
+
+	if (surface_pattern->surface->status)
+	    return surface_pattern->surface->status;
+    }
+
+    return CAIRO_STATUS_SUCCESS;
+}
+
 void
 _cairo_pattern_fini (cairo_pattern_t *pattern)
 {
diff --git a/src/cairoint.h b/src/cairoint.h
index b1240b7..e40a51a 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -2239,6 +2239,10 @@ cairo_private cairo_status_t
 _cairo_pattern_init_copy (cairo_pattern_t	*pattern,
 			  const cairo_pattern_t *other);
 
+cairo_private cairo_status_t
+_cairo_pattern_init_snapshot (cairo_pattern_t       *pattern,
+			      const cairo_pattern_t *other);
+
 cairo_private void
 _cairo_pattern_init_solid (cairo_solid_pattern_t	*pattern,
 			   const cairo_color_t		*color,


More information about the cairo-commit mailing list