[cairo] [PATCH 2/2] Fix optimization of white IN dest compositing

Andrea Canciani ranma42 at gmail.com
Mon Jan 17 01:45:24 PST 2011


The optimization of any opaque color IN an alpha-only surface is a
noop (it multiplies the alpha of each pixel of the destination by 1).
The same does not apply to colored destinations, because IN replaces
the original color with the color of the source.

Fixes white-in-noop.
---
 src/cairo-surface.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 36eaa79..b9d9e16 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1899,7 +1899,8 @@ _cairo_surface_fill_region (cairo_surface_t	   *surface,
 
     /* catch a common reduction of _cairo_clip_combine_with_surface() */
     if (op == CAIRO_OPERATOR_IN &&
-	_cairo_color_equal (color, CAIRO_COLOR_WHITE))
+	surface->content == CAIRO_CONTENT_ALPHA &&
+	CAIRO_COLOR_IS_OPAQUE (color))
     {
 	return CAIRO_STATUS_SUCCESS;
     }
-- 
1.7.1



More information about the cairo mailing list