svg: Add support for flattening SOURCE painting when there's nothing beneath it

This avoids unnecessary rasterization in many cases when using
cairo_surface_create_similar with an SVG surface. Because of that
it eliminates test-suite failures for the -similar cases where we
have svg-specific reference images. Namely:

	font-matrix-translation, ft-text-vertical-layout-type1,
	ft-text-vertical-layout-type3, mask, meta-surface-pattern,
	paint-source-alpha, paint-with-alpha, rotate-image-surface-paint,
	scale-source-surface-paint, source-clip-scale, text-pattern,
	text-rotate

In all of these cases the test suite was kindly noticing that we
weren't getting the same 'native' SVG output that was desired.
This commit is contained in:
Carl Worth 2008-02-20 01:43:51 -08:00
parent e7c6e291a6
commit 98189d860e

View file

@ -752,11 +752,18 @@ _cairo_svg_surface_analyze_operation (cairo_svg_surface_t *surface,
if (cairo_svg_force_fallbacks)
return FALSE;
if (document->svg_version < CAIRO_SVG_VERSION_1_2)
if (op != CAIRO_OPERATOR_OVER)
return CAIRO_INT_STATUS_UNSUPPORTED;
if (document->svg_version >= CAIRO_SVG_VERSION_1_2)
return CAIRO_STATUS_SUCCESS;
return CAIRO_STATUS_SUCCESS;
if (op == CAIRO_OPERATOR_OVER)
return CAIRO_STATUS_SUCCESS;
/* The SOURCE operator is onlysupported if there is nothing
* painted underneath. */
if (op == CAIRO_OPERATOR_SOURCE)
return CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY;
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t