quartz: Do not use opaque patterns as masks

When an opaque surface is used as a mask, Quartz converts it to
greyscale and uses the result as an alpha value. Cairo expects the
mask operation to ignore the color components and only use the alpha
of the pattern.

The expected behavior can be achieved by drawing the mask on a
temporary surface with an alpha channel.

Fixes clear-source.
This commit is contained in:
Andrea Canciani 2011-01-01 22:36:45 +01:00
parent 7d89d69c49
commit aa2fb0c05f

View file

@ -2399,8 +2399,12 @@ _cairo_quartz_surface_mask_cg (cairo_quartz_surface_t *surface,
}
/* For these, we can skip creating a temporary surface, since we already have one */
if (mask->type == CAIRO_PATTERN_TYPE_SURFACE && mask->extend == CAIRO_EXTEND_NONE)
return _cairo_quartz_surface_mask_with_surface (surface, op, source, (cairo_surface_pattern_t *) mask, clip);
if (mask->type == CAIRO_PATTERN_TYPE_SURFACE && mask->extend == CAIRO_EXTEND_NONE) {
const cairo_surface_pattern_t *mask_spat = (const cairo_surface_pattern_t *) mask;
if (mask_spat->surface->content & CAIRO_CONTENT_ALPHA)
return _cairo_quartz_surface_mask_with_surface (surface, op, source, mask_spat, clip);
}
return _cairo_quartz_surface_mask_with_generic (surface, op, source, mask, clip);
}