[cairo] [PATCH] gl: return unsupported if the source surface type is gl-window in upload_boxes()

Chuanbo Weng strgnm at gmail.com
Thu Jul 12 01:44:19 PDT 2012


When the source surface type is gl-window in upload_boxes(), return
unsupported. Together with the patch I sent just now, fixes 8 fails
in cairo-test-suite.
---
 src/cairo-gl-surface.c              |   13 +++++++++++++
 src/cairo-spans-compositor.c        |    6 ++++++
 src/cairo-surface-backend-private.h |    3 +++
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 6b9bc67..1a15d77 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -1307,6 +1307,14 @@ _cairo_gl_surface_glyphs (void			*surface,
 				     clip);
 }
 
+cairo_bool_t
+_cairo_gl_surface_is_window (void *abstract_surface)
+{
+    cairo_gl_surface_t *surface = abstract_surface;
+
+    return !_cairo_gl_surface_is_texture (surface);
+}
+
 static const cairo_surface_backend_t _cairo_gl_surface_backend = {
     CAIRO_SURFACE_TYPE_GL,
     _cairo_gl_surface_finish,
@@ -1337,4 +1345,9 @@ static const cairo_surface_backend_t _cairo_gl_surface_backend = {
     _cairo_gl_surface_fill,
     NULL, /* fill/stroke */
     _cairo_gl_surface_glyphs,
+    NULL, /* has_show_text_glyphs */
+    NULL, /* show_text_glyphs */
+    NULL, /* get_supported_mime_types */
+
+    _cairo_gl_surface_is_window,
 };
diff --git a/src/cairo-spans-compositor.c b/src/cairo-spans-compositor.c
index 602d6a6..c5e6c83 100644
--- a/src/cairo-spans-compositor.c
+++ b/src/cairo-spans-compositor.c
@@ -491,6 +491,12 @@ upload_boxes (const cairo_spans_compositor_t *compositor,
     TRACE ((stderr, "%s\n", __FUNCTION__));
 
     src = _cairo_pattern_get_source(source, &limit);
+
+    if (src->backend->is_second_surface_type){
+        if(src->backend->is_second_surface_type(src))
+            return CAIRO_INT_STATUS_UNSUPPORTED;
+    }
+
     if (!(src->type == CAIRO_SURFACE_TYPE_IMAGE || src->type == dst->type))
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
diff --git a/src/cairo-surface-backend-private.h b/src/cairo-surface-backend-private.h
index c275ce6..4b78169 100644
--- a/src/cairo-surface-backend-private.h
+++ b/src/cairo-surface-backend-private.h
@@ -199,6 +199,9 @@ struct _cairo_surface_backend {
 
     const char **
     (*get_supported_mime_types)	(void			    *surface);
+
+    cairo_bool_t
+    (*is_second_surface_type)	(void			    *surface);
 };
 
 cairo_private cairo_status_t
-- 
1.7.5.4



More information about the cairo mailing list