[cairo-commit] 4 commits - perf/cairo-perf-chart.c src/cairo-gl-operand.c src/cairo-gl-spans-compositor.c src/cairo-gl-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Jul 12 10:15:51 PDT 2012


 perf/cairo-perf-chart.c         |   53 +++++++++++++++++++++++-----------------
 src/cairo-gl-operand.c          |    3 ++
 src/cairo-gl-spans-compositor.c |    3 ++
 src/cairo-gl-surface.c          |    1 
 4 files changed, 38 insertions(+), 22 deletions(-)

New commits:
commit 21e3f2e9034b64131075d82a4e34868dc72f2249
Author: Chuanbo Weng <strgnm at gmail.com>
Date:   Thu Jul 12 18:08:51 2012 +0100

    gl: copy_boxes() does not support copying from a non-texture source
    
    So check for the appropriate surface type at the start and return
    UNSUPPORTED if we cannot handle it directly. We will then fallback to
    pushing the image instead.
    
    Together with the previous patch, fixes 8 fails in cairo-test-suite.

diff --git a/src/cairo-gl-spans-compositor.c b/src/cairo-gl-spans-compositor.c
index 4c5cef6..171aee4 100644
--- a/src/cairo-gl-spans-compositor.c
+++ b/src/cairo-gl-spans-compositor.c
@@ -323,6 +323,9 @@ static cairo_int_status_t copy_boxes (void *_dst,
     cairo_int_status_t status;
 
     TRACE ((stderr, "%s\n", __FUNCTION__));
+    if (! _cairo_gl_surface_is_texture (src))
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
     status = _cairo_gl_composite_init (&setup, CAIRO_OPERATOR_SOURCE, _dst, FALSE);
     if (unlikely (status))
         goto FAIL;
commit 77f8bd3199b546b3ba039afc90337159636b63f6
Author: Chuanbo Weng <strgnm at gmail.com>
Date:   Thu Jul 12 18:07:42 2012 +0100

    gl: Create a new texture surface if the source surface type is gl-window
    
    When the source surface type is gl-window, we should return unsupported
    and then create a new texture surface for it. Based on the code of
    Henry's tree.

diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
index 4ef3307..033d45e 100644
--- a/src/cairo-gl-operand.c
+++ b/src/cairo-gl-operand.c
@@ -215,6 +215,9 @@ _cairo_gl_subsurface_operand_init (cairo_gl_operand_t *operand,
     if (surface->base.device && surface->base.device != dst->base.device)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
+    if (! _cairo_gl_surface_is_texture (surface))
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
     status = _resolve_multisampling (surface);
     if (unlikely (status))
 	return status;
commit ac2668dd087ce32d86d3bd44f7886638e76b5b8a
Author: Dongyeon Kim <dy5.kim at samsung.com>
Date:   Thu Jul 12 18:13:43 2012 +0100

    gl: Set is_clear flag to FALSE after map_to_image
    
    In _cairo_gl_surface_map_to_image(), the image surface data has been
    filled by glReadPixels, so is_clear flag should be set to FALSE.
    Otherwise mapped image surface does not get drawn as it is presumed
    clear and so returns true from nothing_to_do().

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 6b9bc67..8b63fd2 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -1121,6 +1121,7 @@ _cairo_gl_surface_map_to_image (void      *abstract_surface,
 	    free(row);
     }
 
+    image->base.is_clear = FALSE;
     return image;
 }
 
commit 70c2125e2c968358a8c7ddaa4e356e9b0de9c323
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jul 12 18:11:21 2012 +0100

    perf/chart: Render a solid bar if the column is too narrow for the gradient
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/perf/cairo-perf-chart.c b/perf/cairo-perf-chart.c
index df0bd88..a993ce8 100644
--- a/perf/cairo-perf-chart.c
+++ b/perf/cairo-perf-chart.c
@@ -359,21 +359,26 @@ add_chart (struct chart *c,
 	dx = c->width / (double) (c->num_tests * c->num_reports);
 	x = dx * (c->num_reports * test + report - .5);
 
-	set_report_gradient (c, report,
-			     floor (x), c->height / 2.,
-			     floor (x + dx) - floor (x),
-			     ceil (-dy*value - c->height/2.) + c->height/2.);
-
 	cairo_rectangle (c->cr,
 			 floor (x), c->height / 2.,
 			 floor (x + dx) - floor (x),
 			 ceil (-dy*value - c->height/2.) + c->height/2.);
-	cairo_fill_preserve (c->cr);
-	cairo_save (c->cr);
-	cairo_clip_preserve (c->cr);
-	set_report_color (c, report);
-	cairo_stroke (c->cr);
-	cairo_restore (c->cr);
+	if (dx < 5) {
+	    set_report_color (c, report);
+	    cairo_fill (c->cr);
+	} else {
+	    set_report_gradient (c, report,
+				 floor (x), c->height / 2.,
+				 floor (x + dx) - floor (x),
+				 ceil (-dy*value - c->height/2.) + c->height/2.);
+
+	    cairo_fill_preserve (c->cr);
+	    cairo_save (c->cr);
+	    cairo_clip_preserve (c->cr);
+	    set_report_color (c, report);
+	    cairo_stroke (c->cr);
+	    cairo_restore (c->cr);
+	}
 
 	/* Skip the label if the difference between the two is less than 0.1% */
 	if (fabs (value) < 0.1)
@@ -423,21 +428,25 @@ add_chart (struct chart *c,
 	dx = c->width / (double) (c->num_tests * (c->num_reports+1));
 	x = dx * ((c->num_reports+1) * test + report + .5);
 
-	set_report_gradient (c, report,
-			 floor (x), c->height,
-			 floor (x + dx) - floor (x),
-			 floor (c->height - dy*value) - c->height);
-
 	cairo_rectangle (c->cr,
 			 floor (x), c->height,
 			 floor (x + dx) - floor (x),
 			 floor (c->height - dy*value) - c->height);
-	cairo_fill_preserve (c->cr);
-	cairo_save (c->cr);
-	cairo_clip_preserve (c->cr);
-	set_report_color (c, report);
-	cairo_stroke (c->cr);
-	cairo_restore (c->cr);
+	if (dx < 5) {
+	    set_report_color (c, report);
+	    cairo_fill (c->cr);
+	} else {
+	    set_report_gradient (c, report,
+				 floor (x), c->height,
+				 floor (x + dx) - floor (x),
+				 floor (c->height - dy*value) - c->height);
+	    cairo_fill_preserve (c->cr);
+	    cairo_save (c->cr);
+	    cairo_clip_preserve (c->cr);
+	    set_report_color (c, report);
+	    cairo_stroke (c->cr);
+	    cairo_restore (c->cr);
+	}
     }
 }
 


More information about the cairo-commit mailing list