[cairo-commit] src/cairo-surface.c

Andrea Canciani ranma42 at kemper.freedesktop.org
Sat Apr 3 14:22:19 PDT 2010


 src/cairo-surface.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 7c2c3f621f9b009b97c5f269bf313be926cc51c7
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Sat Apr 3 22:54:57 2010 +0200

    Correct masking optimization
    
    In _cairo_surface_mask() there was an invaild optimization (it failed
    for surfaces without alpha content). Using _cairo_pattern_is_clear()
    is the correct way to evaluate if a pattern is clear.
    
    Fixes clear-source

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 27b5c83..9a3d329 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1962,10 +1962,10 @@ _cairo_surface_mask (cairo_surface_t		*surface,
 	return CAIRO_STATUS_SUCCESS;
 
     /* If the mask is blank, this is just an expensive no-op */
-    if (mask->type == CAIRO_PATTERN_TYPE_SURFACE) {
-	const cairo_surface_pattern_t *spattern = (cairo_surface_pattern_t *) mask;
-	if (spattern->surface->is_clear)
-	    return CAIRO_STATUS_SUCCESS;
+    if (_cairo_pattern_is_clear (mask) &&
+	_cairo_operator_bounded_by_mask (op))
+    {
+	return CAIRO_STATUS_SUCCESS;
     }
 
     status = _pattern_has_error (source);


More information about the cairo-commit mailing list