[gtk/wip/chergert/macos-iosurface] macos: avoid extra opaque changes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/macos-iosurface] macos: avoid extra opaque changes
- Date: Mon, 14 Feb 2022 01:09:38 +0000 (UTC)
commit 81bbf7186ec2b877d1a8ea551a965d7ffda541ea
Author: Christian Hergert <christian hergert me>
Date: Sun Feb 13 17:09:10 2022 -0800
macos: avoid extra opaque changes
gdk/macos/gdkmacosglcontext-private.h | 2 ++
gdk/macos/gdkmacosglcontext.c | 8 ++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gdk/macos/gdkmacosglcontext-private.h b/gdk/macos/gdkmacosglcontext-private.h
index 9d9b378b16..8b3eac2ca6 100644
--- a/gdk/macos/gdkmacosglcontext-private.h
+++ b/gdk/macos/gdkmacosglcontext-private.h
@@ -47,6 +47,8 @@ struct _GdkMacosGLContext
GLuint texture;
GLuint target;
GLuint fbo;
+
+ guint last_opaque : 1;
};
struct _GdkMacosGLContextClass
diff --git a/gdk/macos/gdkmacosglcontext.c b/gdk/macos/gdkmacosglcontext.c
index 9305188bcd..57e913337c 100644
--- a/gdk/macos/gdkmacosglcontext.c
+++ b/gdk/macos/gdkmacosglcontext.c
@@ -243,8 +243,12 @@ gdk_macos_gl_context_allocate (GdkMacosGLContext *self)
/* Alter to an opaque surface if necessary */
opaque = _gdk_macos_surface_is_opaque (GDK_MACOS_SURFACE (surface));
- if (!CHECK (NULL, CGLSetParameter (self->cgl_context, kCGLCPSurfaceOpacity, &opaque)))
- return;
+ if (opaque != self->last_opaque)
+ {
+ self->last_opaque = !!opaque;
+ if (!CHECK (NULL, CGLSetParameter (self->cgl_context, kCGLCPSurfaceOpacity, &opaque)))
+ return;
+ }
if (self->texture == 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]