[gtk/wip/chergert/for-4-6: 8/56] macos: remove duplicated opaque_region field




commit 94deb551aa572e35b8e1316b98b20f6f549fe941
Author: Christian Hergert <christian hergert me>
Date:   Fri Feb 25 13:14:22 2022 -0800

    macos: remove duplicated opaque_region field
    
    This can be relied upon from GdkSurface and we do not need to keep a copy
    of it. Just remove it and use the GdkSurface.opaque_region field.

 gdk/macos/gdkmacossurface-private.h |  1 -
 gdk/macos/gdkmacossurface.c         | 15 +++++----------
 2 files changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/gdk/macos/gdkmacossurface-private.h b/gdk/macos/gdkmacossurface-private.h
index 08947f1ce3..b853211afc 100644
--- a/gdk/macos/gdkmacossurface-private.h
+++ b/gdk/macos/gdkmacossurface-private.h
@@ -49,7 +49,6 @@ struct _GdkMacosSurface
   GdkMacosBuffer *buffer;
   GdkMacosBuffer *front;
   GPtrArray *monitors;
-  cairo_region_t *opaque_region;
   char *title;
 
   int root_x;
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index 5998c4162f..e437357a96 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -115,12 +115,6 @@ gdk_macos_surface_set_opaque_region (GdkSurface     *surface,
 
   g_assert (GDK_IS_MACOS_SURFACE (self));
 
-  if (region != self->opaque_region)
-    {
-      g_clear_pointer (&self->opaque_region, cairo_region_destroy);
-      self->opaque_region = cairo_region_copy (region);
-    }
-
   if ((nsview = _gdk_macos_surface_get_view (GDK_MACOS_SURFACE (surface))))
     [(GdkMacosView *)nsview setOpaqueRegion:region];
 }
@@ -417,7 +411,6 @@ gdk_macos_surface_destroy (GdkSurface *surface,
     }
 
   g_clear_pointer (&self->title, g_free);
-  g_clear_pointer (&self->opaque_region, cairo_region_destroy);
 
   if (window != NULL)
     [window close];
@@ -619,14 +612,16 @@ _gdk_macos_surface_get_shadow (GdkMacosSurface *self,
 gboolean
 _gdk_macos_surface_is_opaque (GdkMacosSurface *self)
 {
+  GdkSurface *surface = (GdkSurface *)self;
+
   g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), FALSE);
 
-  if (self->opaque_region != NULL &&
-      cairo_region_num_rectangles (self->opaque_region) == 1)
+  if (surface->opaque_region != NULL &&
+      cairo_region_num_rectangles (surface->opaque_region) == 1)
     {
       cairo_rectangle_int_t extents;
 
-      cairo_region_get_extents (self->opaque_region, &extents);
+      cairo_region_get_extents (surface->opaque_region, &extents);
 
       return (extents.x == 0 &&
               extents.y == 0 &&


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