diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 496a8840c..c8f4353fc 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -1105,7 +1105,7 @@ _cairo_pattern_is_opaque (const cairo_pattern_t *abstract_pattern) case CAIRO_PATTERN_TYPE_SOLID: return _cairo_pattern_is_opaque_solid (abstract_pattern); case CAIRO_PATTERN_TYPE_SURFACE: - return _cairo_surface_is_opaque (pattern->surface.surface); + return cairo_surface_get_content (pattern->surface.surface) == CAIRO_CONTENT_COLOR; case CAIRO_PATTERN_TYPE_LINEAR: case CAIRO_PATTERN_TYPE_RADIAL: return _gradient_is_opaque (&pattern->gradient.base); diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 3218607e1..b7d0e75f2 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -170,6 +170,7 @@ cairo_surface_get_content (cairo_surface_t *surface) { return surface->content; } +slim_hidden_def(cairo_surface_get_content); /** * cairo_surface_status: @@ -2002,42 +2003,6 @@ _cairo_surface_composite_shape_fixup_unbounded (cairo_surface_t *dst, 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; -} - -/* XXX: This function is funny in a couple of ways. First it seems to - * be computing something like "not translucent" rather than "opaque" - * since it returns TRUE for an A1 image surface. Second, it just - * gives up on anything other than an image surface. - * - * I imagine something that might be more useful here (or in addition) - * would be cairo_surface_get_content. - */ -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 FALSE; -} - /** * _cairo_surface_copy_pattern_for_destination * @pattern: the pattern to copy diff --git a/src/cairoint.h b/src/cairoint.h index 45173c766..e4bf6fc1d 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -2219,6 +2219,7 @@ slim_hidden_proto(cairo_restore) slim_hidden_proto(cairo_save) slim_hidden_proto(cairo_stroke_preserve) slim_hidden_proto(cairo_surface_destroy) +slim_hidden_proto(cairo_surface_get_content) slim_hidden_proto(cairo_push_group) slim_hidden_proto(cairo_push_group_with_content) slim_hidden_proto(cairo_pop_group)