summaryrefslogtreecommitdiff
path: root/src/cairo-ps-surface.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2010-12-04 14:58:52 +0100
committerAndrea Canciani <ranma42@gmail.com>2010-12-13 09:46:09 +0100
commitd1e9bdf7f15fd2ba7d42c6fe18650618d29c4942 (patch)
tree18b440e7829cb41926c56659d9141750799320e0 /src/cairo-ps-surface.c
parentec4c085624d12cef51e583c18306fd4f4c2b6aaa (diff)
ps: Avoid unneeded fallbacks for gradients with opaque stops.
_cairo_pattern_is_opaque() returns false for none-extended linear gradients and for radial gradients, but fallback is only needed if they have non-opaque stops. This can be tested using _cairo_pattern_alpha_range(), which only analyses the part of the pattern which is drawn. Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
Diffstat (limited to 'src/cairo-ps-surface.c')
-rw-r--r--src/cairo-ps-surface.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 784e8899..b53157e6 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1779,6 +1779,8 @@ _cairo_ps_surface_analyze_operation (cairo_ps_surface_t *surface,
const cairo_pattern_t *pattern,
const cairo_rectangle_int_t *extents)
{
+ double min_alpha;
+
if (surface->force_fallbacks &&
surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
{
@@ -1823,7 +1825,11 @@ _cairo_ps_surface_analyze_operation (cairo_ps_surface_t *surface,
surface_pattern);
}
- if (_cairo_pattern_is_opaque (pattern, extents))
+ /* Patterns whose drawn part is opaque are directly supported;
+ those whose drawn part is partially transparent can be
+ supported by flattening the alpha. */
+ _cairo_pattern_alpha_range (pattern, &min_alpha, NULL);
+ if (CAIRO_ALPHA_IS_OPAQUE (min_alpha))
return CAIRO_STATUS_SUCCESS;
return CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY;