[gtk/wip/chergert/gdk-macos-gl-renderer: 15/26] macos: setup clip for flushBuffer




commit b56ace5f33e044ce45fa19bfc1c0dfab9e3a9444
Author: Christian Hergert <chergert redhat com>
Date:   Tue Oct 27 15:55:43 2020 -0700

    macos: setup clip for flushBuffer
    
    We want to try to reduce how much of the screen is damaged when
    swapping buffers, and this wraps (through NSOpenGLContext) to the
    kCGLCPSwapRectangle.

 gdk/macos/gdkmacosglcontext.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gdk/macos/gdkmacosglcontext.c b/gdk/macos/gdkmacosglcontext.c
index 15c36b6c26..73dca20fe1 100644
--- a/gdk/macos/gdkmacosglcontext.c
+++ b/gdk/macos/gdkmacosglcontext.c
@@ -196,6 +196,7 @@ gdk_macos_gl_context_end_frame (GdkDrawContext *context,
   GdkMacosGLContext *self = GDK_MACOS_GL_CONTEXT (context);
   GdkMacosSurface *surface;
   NSView *nsview;
+  cairo_rectangle_int_t extents;
 
   g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
   g_assert (self->gl_context != nil);
@@ -207,8 +208,13 @@ gdk_macos_gl_context_end_frame (GdkDrawContext *context,
 
   GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->end_frame (context, painted);
 
+  G_STATIC_ASSERT (sizeof (GLint) == sizeof (int));
 
+  cairo_region_get_extents (painted, &extents);
 
+  [self->gl_context
+         setValues:(GLint *)&extents
+      forParameter:NSOpenGLCPSwapRectangle];
   [self->gl_context flushBuffer];
 }
 


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