[PATCH 2/2] gl: Ensure that gl surface resizes are properly applied
Alexandros Frantzis
alexandros.frantzis at linaro.org
Fri Jan 7 03:27:27 PST 2011
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 adds tracking of
pending resizes and ensures that a resize always take effect the next time
a resized surface is used as the target.
---
src/cairo-gl-device.c | 4 +++-
src/cairo-gl-private.h | 1 +
src/cairo-gl-surface.c | 2 ++
3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index 3793f9d..44b37d9 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -279,7 +279,7 @@ 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->resize_pending)
return;
_cairo_gl_composite_flush (ctx);
@@ -309,4 +309,6 @@ _cairo_gl_context_set_destination (cairo_gl_context_t *ctx,
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
+
+ surface->resize_pending = FALSE;
}
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index 2f47b9a..9858615 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -88,6 +88,7 @@ typedef struct _cairo_gl_surface {
cairo_surface_t base;
int width, height;
+ cairo_bool_t resize_pending;
GLuint tex; /* GL texture object containing our data. */
GLuint fb; /* GL framebuffer object wrapping our data. */
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 0e4d275..724b3b6 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->resize_pending = TRUE;
}
static cairo_surface_t *
@@ -467,6 +468,7 @@ cairo_gl_surface_set_size (cairo_surface_t *abstract_surface,
surface->width = width;
surface->height = height;
+ surface->resize_pending = TRUE;
}
int
--
1.7.1
--EVF5PPMfhYS0aIcm--
More information about the cairo
mailing list