[cairo-commit] 2 commits - src/cairo-recording-surface.c

Uli Schlachter psychon at kemper.freedesktop.org
Wed Sep 11 06:36:37 PDT 2013


 src/cairo-recording-surface.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 279d5a2ed1aaa6d5dbfbeab9e4b4ffa6a66aa6f3
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Sep 11 15:28:29 2013 +0200

    recording: Correctly determine alpha of all surfaces
    
    This code has special cases for recording and image surfaces. For all other
    kinds of source surfaces, has_bilevel_alpha was not modified, even though the
    source surface could have an alpha channel.
    
    Fix this by using the same checks as in the general path at the end of this
    function.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index ece904f..ce29b93 100644
--- a/src/cairo-recording-surface.c
+++ b/src/cairo-recording-surface.c
@@ -1637,6 +1637,9 @@ _cairo_recording_surface_merge_source_attributes (cairo_recording_surface_t  *su
 	    if (_cairo_image_analyze_transparency (img_surf) == CAIRO_IMAGE_HAS_ALPHA)
 		surface->has_bilevel_alpha = FALSE;
 
+	} else {
+	    if (!_cairo_pattern_is_clear (source) && !_cairo_pattern_is_opaque (source, NULL))
+		surface->has_bilevel_alpha = FALSE;
 	}
 
 	cairo_surface_destroy (free_me);
commit a6f51fed985f7db37c672bab0b5dab3f89e78282
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Sep 11 15:24:53 2013 +0200

    recording: Fix unitialized variable 'free_me'
    
    This variable should be NULL by default and gets set only if a new reference to
    a surface was acquired through _cairo_surface_snapshot_get_target(). This works,
    because cairo_surface_destroy(NULL) is well-defined and doesn't do anything.
    
    Fixes the following compiler warning:
    
    cairo-recording-surface.c:1642:24: warning: 'free_me' may be used uninitialized
    in this function [-Wmaybe-uninitialized]
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index eb9af46..ece904f 100644
--- a/src/cairo-recording-surface.c
+++ b/src/cairo-recording-surface.c
@@ -1617,7 +1617,7 @@ _cairo_recording_surface_merge_source_attributes (cairo_recording_surface_t  *su
     if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
 	cairo_surface_pattern_t *surf_pat = (cairo_surface_pattern_t *) source;
 	cairo_surface_t *surf = surf_pat->surface;
-	cairo_surface_t *free_me;
+	cairo_surface_t *free_me = NULL;
 
 	if (_cairo_surface_is_snapshot (surf))
 	    free_me = surf = _cairo_surface_snapshot_get_target (surf);


More information about the cairo-commit mailing list