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

Eric Anholt anholt at kemper.freedesktop.org
Sat Jan 23 10:46:26 PST 2010


 src/cairo-gl-surface.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

New commits:
commit ea7fda442c169a159b2e3c51894a0f5e70a13984
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Jan 22 16:26:38 2010 -0800

    [gl] Release the context acquired in surface_create.
    
    Fixes assertion failures in many testcases since
    cf9ea9f2f0ea1e1b42dc1507ed0dac4dfbf5d387

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 2e86266..220ec0f 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -545,6 +545,8 @@ cairo_gl_surface_create (cairo_device_t		*abstract_device,
 	return _cairo_surface_create_in_error (status);
     }
 
+    _cairo_gl_context_release (ctx);
+
     return &surface->base;
 }
 slim_hidden_def (cairo_gl_surface_create);
commit 20990365f3885457d66b4a8bef865f027a98333f
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Jan 22 16:13:02 2010 -0800

    [gl] Emit rectanges a whole primitive at a time.
    
    Since the spans rework, we were emitting half a primitive at a time,
    and if we flushed our VBO full of quads out halfway through, we could
    end up dropping the primitive and then out of phase.

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 5c57bed..2e86266 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -2116,25 +2116,22 @@ _cairo_gl_emit_span_vertex (cairo_gl_surface_span_renderer_t *renderer,
 }
 
 static void
-_cairo_gl_emit_span (cairo_gl_surface_span_renderer_t *renderer,
-		     int x, int y1, int y2,
-		     uint8_t alpha)
-{
-    float *vertices = _cairo_gl_span_renderer_get_vbo (renderer, 2);
-
-    _cairo_gl_emit_span_vertex (renderer, x, y1, alpha, vertices);
-    _cairo_gl_emit_span_vertex (renderer, x, y2, alpha,
-			       vertices + renderer->vertex_size / 4);
-}
-
-static void
 _cairo_gl_emit_rectangle (cairo_gl_surface_span_renderer_t *renderer,
 			  int x1, int y1,
 			  int x2, int y2,
 			  int coverage)
 {
-    _cairo_gl_emit_span (renderer, x1, y1, y2, coverage);
-    _cairo_gl_emit_span (renderer, x2, y2, y1, coverage);
+    float *vertices = _cairo_gl_span_renderer_get_vbo (renderer, 4);
+    int vsize = renderer->vertex_size / 4;
+
+    _cairo_gl_emit_span_vertex (renderer, x1, y1, coverage,
+				vertices + vsize * 0);
+    _cairo_gl_emit_span_vertex (renderer, x1, y2, coverage,
+				vertices + vsize * 1);
+    _cairo_gl_emit_span_vertex (renderer, x2, y2, coverage,
+				vertices + vsize * 2);
+    _cairo_gl_emit_span_vertex (renderer, x2, y1, coverage,
+				vertices + vsize * 3);
 }
 
 static cairo_status_t


More information about the cairo-commit mailing list