[gtk/wip/chergert/macos-iosurface: 10/11] macos: add helper to check if surface is opaque
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/macos-iosurface: 10/11] macos: add helper to check if surface is opaque
- Date: Mon, 14 Feb 2022 10:22:24 +0000 (UTC)
commit 03084f11ce34f52b9e64c861368112fca85ed5f6
Author: Christian Hergert <christian hergert me>
Date: Mon Feb 14 02:18:51 2022 -0800
macos: add helper to check if surface is opaque
gdk/macos/gdkmacossurface-private.h | 1 +
gdk/macos/gdkmacossurface.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
---
diff --git a/gdk/macos/gdkmacossurface-private.h b/gdk/macos/gdkmacossurface-private.h
index ccb8a83179..61ea1ba00d 100644
--- a/gdk/macos/gdkmacossurface-private.h
+++ b/gdk/macos/gdkmacossurface-private.h
@@ -131,6 +131,7 @@ void _gdk_macos_surface_set_opacity (GdkMacosSurface
void _gdk_macos_surface_get_root_coords (GdkMacosSurface *self,
int *x,
int *y);
+gboolean _gdk_macos_surface_is_opaque (GdkMacosSurface *self);
G_END_DECLS
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index 937b0de5d4..b6ec945ac9 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -603,6 +603,27 @@ _gdk_macos_surface_get_shadow (GdkMacosSurface *self,
*right = self->shadow_right;
}
+gboolean
+_gdk_macos_surface_is_opaque (GdkMacosSurface *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)
+ {
+ cairo_rectangle_int_t extents;
+
+ cairo_region_get_extents (self->opaque_region, &extents);
+
+ return (extents.x == 0 &&
+ extents.y == 0 &&
+ extents.width == GDK_SURFACE (self)->width &&
+ extents.height == GDK_SURFACE (self)->height);
+ }
+
+ return FALSE;
+}
+
const char *
_gdk_macos_surface_get_title (GdkMacosSurface *self)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]