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

Alexandros Frantzis alexandros.frantzis at linaro.org
Tue Jan 11 13:23:09 PST 2011


On Tue, Jan 11, 2011 at 08:43:51PM +0100, Andrea Canciani wrote:
> 
> In d7bb8193385ac70c796f645175ddcdb1eeff7adf:
> ...
>         if (condition &&
>             other_condition &&
>             yet_another)
>         {
>             do_something ();
>         }
> 
> And note that this last example also shows a situation in which the
> opening brace really needs to be on its own line. The following looks awful:
> 
>         if (condition &&
>             other_condition &&
>             yet_another) {      /* Yuck! */
>             do_something ();
>         }
> ...
> The old code and many other places in cairo-gl are not respecting the
> CODING_STYLE, so fixing all of this might well go in a different commit,
> but it's still worth knowing (you were adding a similar CODING_STYLE
> break in 296dd046c36d7e969052e9d9e2c7e88e53db038c).
> 

Hi Andrea!

Thanks for pointing this out.

> >
> > git://git.linaro.org/people/afrantzis/cairo.git
> >
> > The only issue I see with this approach is the case the destination is
> > set, it is resized UINT_MAX + 1 times (without any other surface being
> > set as the destination in the meantime) and then set again. In this case
> > the update will not be detected because the serial will have remained
> > the same. Of course this is extremely unlikely to happen :)
> 
> Wouldn't a boolean flag be sufficient to track if it needs updating
> and solve the wraparound issue?
> 
> The attachment contains a patch which should implement this idea.
> I believe it is correct and equivalent to your code (except that it ignores
> noop set_size()'s and does not suffer from the wraparound issue).
> 
> Andrea

As Chris pointed out, a boolean flag (my first patch, similar to yours)
is not sufficient because the surface may be the destination of multiple
gl contexts. Using a boolean flag will cause an invalidation of only one
of the contexts but not the rest.

Another option (my second patch, branch 'gl-window-surface-resize') is
to directly track the width/height of the current target to detect
resizes.

I have incorporated the noop set_size() in the
'gl-window-surface-resize2' git branch.

Thanks,
Alexandros



More information about the cairo mailing list