[gtk/wip/chergert/macos-iosurface] cleanup damage handling



commit 77bc43e84be943731064c5ce59624f293a93bf80
Author: Christian Hergert <christian hergert me>
Date:   Fri Feb 11 04:25:18 2022 -0800

    cleanup damage handling

 gdk/macos/gdkmacosglcontext.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gdk/macos/gdkmacosglcontext.c b/gdk/macos/gdkmacosglcontext.c
index 592d3c0bbf..ca939c598c 100644
--- a/gdk/macos/gdkmacosglcontext.c
+++ b/gdk/macos/gdkmacosglcontext.c
@@ -426,18 +426,17 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
 {
   GdkMacosGLContext *self = (GdkMacosGLContext *)context;
   GdkMacosBuffer *buffer;
+  cairo_region_t *copy;
   GdkSurface *surface;
 
   g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
 
+  copy = cairo_region_copy (region);
   surface = gdk_draw_context_get_surface (context);
   buffer = _gdk_macos_surface_get_buffer (GDK_MACOS_SURFACE (surface));
 
   _gdk_macos_buffer_set_flipped (buffer, TRUE);
 
-  g_clear_pointer (&self->damage, cairo_region_destroy);
-  self->damage = cairo_region_copy (region);
-
   /* Begin a Core Animation transaction so that all changes we
    * make within the window are seen atomically.
    */
@@ -450,6 +449,9 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
   GDK_GL_CONTEXT (context)->default_framebuffer = self->fbo;
 
   GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->begin_frame (context, prefers_high_depth, 
region);
+
+  g_clear_pointer (&self->damage, cairo_region_destroy);
+  self->damage = g_steal_pointer (&copy);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]