[cairo] [PATCH] [cairo-gl] Fix support for gl window surface resizes

Alexandros Frantzis alexandros.frantzis at linaro.org
Fri Jan 7 09:59:45 PST 2011


On Fri, Jan 07, 2011 at 03:40:29PM +0000, Chris Wilson wrote:
> On Fri, 7 Jan 2011 16:31:43 +0200, Alexandros Frantzis <alexandros.frantzis at linaro.org> wrote:
> > From 94ced6d4c126fc8142dd32b2e761be8f9012ef52 Mon Sep 17 00:00:00 2001
> > From: Alexandros Frantzis <alexandros.frantzis at linaro.org>
> > Date: Fri, 7 Jan 2011 13:27:27 +0200
> > Subject: [PATCH 2/2] 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 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;
> 
> Hmm, don't you need to invalidate all contexts that have this surface as
> they current target?
> -Chris
> 
> -- 
> Chris Wilson, Intel Open Source Technology Centre
> 

Hi Chris,

you are right, I hadn't considered this use case at all.

I have attached a new version of the patch (and updated the git branch)
in which each gl_context holds the last known width/height of its
current target and checks them in set_destination to detect resizes.

Thanks,
Alexandros
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-gl-Ensure-that-gl-surface-resizes-are-properly-appli.patch
Type: text/x-diff
Size: 2389 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110107/3cc83b7b/attachment.patch>


More information about the cairo mailing list