summaryrefslogtreecommitdiff
path: root/src/cairo-surface.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-04-14 17:25:54 -0700
committerCarl Worth <cworth@cworth.org>2006-04-14 17:25:54 -0700
commitb7309d065e49ae73ff8d90feca35f6b8f35922d2 (patch)
tree70e358c7d138642777da03f598f14b6ee90286d4 /src/cairo-surface.c
parenta7f4f1b350e158eca394da63eed0e14a97480a5a (diff)
Farm out the surface and pattern analysis functions away from cairo-ps-surface.c.
We're setting things up here for better sharing as PDF surface (and others) now want to do some of the same analysis.
Diffstat (limited to 'src/cairo-surface.c')
-rw-r--r--src/cairo-surface.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index d0810aa96..5af49da5d 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1693,3 +1693,31 @@ _cairo_surface_composite_shape_fixup_unbounded (cairo_surface_t *dst,
return _cairo_surface_composite_fixup_unbounded_internal (dst, src_rectangle, mask_rectangle,
dst_x, dst_y, width, height);
}
+
+static cairo_bool_t
+_format_is_opaque (cairo_format_t format)
+{
+ switch (format) {
+ case CAIRO_FORMAT_ARGB32:
+ return FALSE;
+ case CAIRO_FORMAT_RGB24:
+ return TRUE;
+ case CAIRO_FORMAT_A8:
+ return FALSE;
+ case CAIRO_FORMAT_A1:
+ return TRUE;
+ }
+ return FALSE;
+}
+
+cairo_bool_t
+_cairo_surface_is_opaque (const cairo_surface_t *surface)
+{
+ if (_cairo_surface_is_image (surface)) {
+ const cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface;
+
+ return _format_is_opaque (image_surface->format);
+ }
+
+ return TRUE;
+}