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

Chris Wilson ickle at kemper.freedesktop.org
Tue Jan 18 02:01:45 PST 2011


 src/cairo-gl-device.c  |    3 ++-
 src/cairo-gl-private.h |    1 +
 src/cairo-gl-surface.c |   10 +++++++---
 3 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit b0e1c837acea2d6a78d5e5b1a011b1d43354b3ac
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Fri Jan 7 13:27:27 2011 +0200

    gl: Ensure that gl surface resizes are properly applied
    
    If a gl surface is resized (with cairo_gl_surface_set_size()) while being the
    current target, the resize does not take effect until the target changes to a
    different surface and back to the original one. This patch allows a gl_context
    to track when the current target surface has been changed and ensures that a
    resize always take effect the next time a resized surface is used as the target.

diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index 3793f9d..048d48b 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -279,12 +279,13 @@ void
 _cairo_gl_context_set_destination (cairo_gl_context_t *ctx,
                                    cairo_gl_surface_t *surface)
 {
-    if (ctx->current_target == surface)
+    if (ctx->current_target == surface && ! surface->needs_update)
         return;
 
     _cairo_gl_composite_flush (ctx);
 
     ctx->current_target = surface;
+    surface->needs_update = FALSE;
 
     if (_cairo_gl_surface_is_texture (surface)) {
         _cairo_gl_ensure_framebuffer (ctx, surface);
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index 2f47b9a..3eb7e09 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -93,6 +93,7 @@ typedef struct _cairo_gl_surface {
     GLuint fb; /* GL framebuffer object wrapping our data. */
     GLuint depth; /* GL framebuffer object holding depth */
     int owns_tex;
+    cairo_bool_t needs_update;
 } cairo_gl_surface_t;
 
 typedef struct cairo_gl_glyph_cache {
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 0e4d275..211fe02 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -214,6 +214,7 @@ _cairo_gl_surface_init (cairo_device_t *device,
 
     surface->width = width;
     surface->height = height;
+    surface->needs_update = FALSE;
 }
 
 static cairo_surface_t *
@@ -465,8 +466,11 @@ cairo_gl_surface_set_size (cairo_surface_t *abstract_surface,
 	return;
     }
 
-    surface->width = width;
-    surface->height = height;
+    if (surface->width != width || surface->height != height) {
+	surface->needs_update = TRUE;
+	surface->width = width;
+	surface->height = height;
+    }
 }
 
 int
commit 45331fe87c319a899fc3cb661dc842fd815282d6
Author: Alexandros Frantzis <alexandros.frantzis at linaro.org>
Date:   Fri Jan 7 13:01:19 2011 +0200

    gl: Fix condition that prevents setting the size of window surfaces
    
    A typo in cairo_gl_surface_set_size() prevents resizing of window surfaces
    while incorrectly allows resizing of texture-backed surfaces.

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index d20fb98..0e4d275 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -459,7 +459,7 @@ cairo_gl_surface_set_size (cairo_surface_t *abstract_surface,
     }
 
     if (! _cairo_surface_is_gl (abstract_surface) ||
-        ! _cairo_gl_surface_is_texture (surface)) {
+        _cairo_gl_surface_is_texture (surface)) {
 	status = _cairo_surface_set_error (abstract_surface,
 		                           _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
 	return;


More information about the cairo-commit mailing list