diff options
author | Timm Bäder <mail@baedert.org> | 2018-11-30 13:14:00 +0100 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2018-12-02 13:25:43 +0100 |
commit | 94745241c2957794cbc1ad308f749d5d3bc7e702 (patch) | |
tree | aedddd58a3f3914a00083e492d44d3c94b3f345f /gdk/x11/gdkglcontext-x11.c | |
parent | 538491efa1d0124176c005ff33fb6e8b27378b94 (diff) | |
download | gtk+-94745241c2957794cbc1ad308f749d5d3bc7e702.tar.gz |
GdkGLContext: Fix damage computation with buffer_age
As per the spec:
> The back buffer can
> either be reported as invalid (has an age of 0) or it may be
> reported to contain the contents from n frames prior to the
> current frame.
So a buffer age of 1 means that the buffer was used in the last frame.
We were handling buffer_age==1 the same as buffer_age==0, i.e. we
returned the full damage for the surface.
[1] https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_buffer_age.txt
Diffstat (limited to 'gdk/x11/gdkglcontext-x11.c')
-rw-r--r-- | gdk/x11/gdkglcontext-x11.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c index 0c8970fd5c..5de9d55cf0 100644 --- a/gdk/x11/gdkglcontext-x11.c +++ b/gdk/x11/gdkglcontext-x11.c @@ -201,31 +201,41 @@ gdk_x11_gl_context_get_damage (GdkGLContext *context) { GdkGLContext *shared; GdkX11GLContext *shared_x11; - + shared = gdk_gl_context_get_shared_context (context); if (shared == NULL) shared = context; shared_x11 = GDK_X11_GL_CONTEXT (shared); gdk_gl_context_make_current (shared); - glXQueryDrawable(dpy, shared_x11->attached_drawable, - GLX_BACK_BUFFER_AGE_EXT, &buffer_age); + glXQueryDrawable (dpy, shared_x11->attached_drawable, + GLX_BACK_BUFFER_AGE_EXT, &buffer_age); - if (buffer_age == 2) - { - if (context->old_updated_area[0]) - return cairo_region_copy (context->old_updated_area[0]); - } - else if (buffer_age == 3) + switch (buffer_age) { - if (context->old_updated_area[0] && - context->old_updated_area[1]) - { - cairo_region_t *damage = cairo_region_copy (context->old_updated_area[0]); - cairo_region_union (damage, context->old_updated_area[1]); - return damage; - } + case 1: + return cairo_region_create (); + break; + + case 2: + if (context->old_updated_area[0]) + return cairo_region_copy (context->old_updated_area[0]); + break; + + case 3: + if (context->old_updated_area[0] && + context->old_updated_area[1]) + { + cairo_region_t *damage = cairo_region_copy (context->old_updated_area[0]); + cairo_region_union (damage, context->old_updated_area[1]); + return damage; + } + break; + + default: + ; } + } return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_parent_class)->get_damage (context); |