buffer = _gdk_macos_surface_get_buffer (GDK_MACOS_SURFACE (surface));
_gdk_macos_buffer_set_flipped (buffer, TRUE);
+ _gdk_macos_buffer_set_damage (buffer, region);
/* Create our render target and bind it */
gdk_gl_context_make_current (GDK_GL_CONTEXT (self));
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 (©);
-
gdk_gl_context_make_current (GDK_GL_CONTEXT (self));
CHECK_GL (NULL, glBindFramebuffer (GL_FRAMEBUFFER, self->fbo));
}
g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
- g_clear_pointer (&self->damage, cairo_region_destroy);
-
if (self->cgl_context != NULL)
CGLUpdateContext (self->cgl_context);
}
gdk_macos_gl_context_get_damage (GdkGLContext *context)
{
GdkMacosGLContext *self = (GdkMacosGLContext *)context;
+ const cairo_region_t *damage;
+ GdkMacosBuffer *buffer;
+ GdkSurface *surface;
- if (self->damage)
- return cairo_region_copy (self->damage);
+ g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
+
+ if ((surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context))) &&
+ (buffer = GDK_MACOS_SURFACE (surface)->front) &&
+ (damage = _gdk_macos_buffer_get_damage (buffer)))
+ return cairo_region_copy (damage);
return GDK_GL_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->get_damage (context);
}
CGLDestroyContext (cgl_context);
}
- g_clear_pointer (&self->damage, cairo_region_destroy);
-
G_OBJECT_CLASS (gdk_macos_gl_context_parent_class)->dispose (gobject);
}