[cairo] [PATCH] [cairo-gl] Fix support for gl window surface resizes
Andrea Canciani
ranma42 at gmail.com
Tue Jan 11 11:43:51 PST 2011
On Tue, Jan 11, 2011 at 8:05 PM, Alexandros Frantzis
<alexandros.frantzis at linaro.org> wrote:
> On Fri, Jan 07, 2011 at 11:28:44AM -0800, Bill Spitzak wrote:
>> You could also put a serialize number on the surface that is
>> incremented when the size changes and test that. This reduces the
>> number of tests and the storage needed by the cairo_t, and allows
>> more things than the width and height to trigger this code without
>> more expense.
>>
>> Alexandros Frantzis wrote:
>> >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.
>>
>
> Hi!
>
> I have implemented this idea in the 'gl-window-surface-resize2' branch:
>
> http://git.linaro.org/gitweb?p=people/afrantzis/cairo.git;a=shortlog;h=refs/heads/gl-window-surface-resize2
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).
>
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gl-Ensure-that-gl-surface-resizes-are-properly-appli.patch
Type: application/octet-stream
Size: 2572 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110111/4aa90d0f/attachment-0001.obj>
More information about the cairo
mailing list