diff options
author | Carl Worth <cworth@cworth.org> | 2007-04-23 10:24:03 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2007-04-25 11:09:31 -0700 |
commit | 29670d37665d184d78d568070cb409acf98ee797 (patch) | |
tree | ddb7bbecd17d7d47a11d4788f9a8d60c138ab6f0 /src/cairo-surface-fallback.c | |
parent | fea5336e2db201be69256ef1bafd418fee98a21e (diff) |
Add a content value to solid patterns
This allows for the surface acquired from the pattern to have the
same content. In particular, in a case such as cairo_paint_with_alpha
we can now acquire an A8 mask surface instead of an ARGB32 mask
surface which can be rendered much more efficiently. This results
in a 4x speedup when using the OVER operator with the recently
added paint-with-alpha test:
Speedups
========
image-rgb paint-with-alpha_image_rgb_over-256 2.25 -> 0.60: 4.45x speedup
███▌
It does slowdown the same test when using the SOURCE operator, but
I don't think we care. Performing SOURCE with a mask is already a very
slow operation, (hitting compositeGeneral), so the slowdown here is
likely from having to convert from A8 back to ARGB32 before the
generalized compositing. So if someone cares about this slowdown,
(though SOURCE with cairo_paint_with_alpha doesn't seem extremely
useful), they will probably be motivated enough to contribute a
customized compositing function to replace compositeGeneral in which
case this slowdown should go away:
image-rgba paint-with-alpha_image_rgb_source-256 3.84 -> 8.86%: 1.94x slowdown
█
Diffstat (limited to 'src/cairo-surface-fallback.c')
-rw-r--r-- | src/cairo-surface-fallback.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c index a504826b..aa434962 100644 --- a/src/cairo-surface-fallback.c +++ b/src/cairo-surface-fallback.c @@ -365,7 +365,8 @@ _clip_and_composite (cairo_clip_t *clip, return CAIRO_STATUS_SUCCESS; if (op == CAIRO_OPERATOR_CLEAR) { - _cairo_pattern_init_solid (&solid_pattern.solid, CAIRO_COLOR_WHITE); + _cairo_pattern_init_solid (&solid_pattern.solid, CAIRO_COLOR_WHITE, + CAIRO_CONTENT_COLOR); src = &solid_pattern.base; op = CAIRO_OPERATOR_DEST_OUT; } @@ -420,7 +421,8 @@ _composite_trap_region (cairo_clip_t *clip, cairo_surface_t *clip_surface = clip ? clip->surface : NULL; if (clip_surface && op == CAIRO_OPERATOR_CLEAR) { - _cairo_pattern_init_solid (&solid_pattern.solid, CAIRO_COLOR_WHITE); + _cairo_pattern_init_solid (&solid_pattern.solid, CAIRO_COLOR_WHITE, + CAIRO_CONTENT_COLOR); src = &solid_pattern.base; op = CAIRO_OPERATOR_DEST_OUT; } @@ -490,7 +492,8 @@ _composite_traps_draw_func (void *closure, if (dst_x != 0 || dst_y != 0) _cairo_traps_translate (info->traps, - dst_x, - dst_y); - _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE); + _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE, + CAIRO_CONTENT_COLOR); if (!src) src = &pattern.base; @@ -894,7 +897,8 @@ _cairo_surface_old_show_glyphs_draw_func (void *closure } } - _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE); + _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE, + CAIRO_CONTENT_COLOR); if (!src) src = &pattern.base; |