[gimp/gimp-2-10] Issue #5989 - performance improvement patches for gtk and gimp



commit 75871f041836e46521d863870d966e3381656e84
Author: Des McGuinness <desmondmcguinness gmail com>
Date:   Wed Aug 4 21:24:18 2021 +0200

    Issue #5989 - performance improvement patches for gtk and gimp
    
    Reviewer comment (Jehan): we have used this patch successfully on our
    installers since start of 2021 (see commit b4d665d of our gtk-osx fork)
    and it really improved the situation. I only fixed minor coding style
    stuff in the patch.
    Looking at what it does, I guess it is not ideal long-term if related to
    10-bit display (as I understand from the comment), which a graphics app
    would want to support properly. But for now, this is better than
    extra-slow display until we get macOS developers able to look at this
    more in depth in the future (I don't think that our dependencies are
    really ready yet for 10-bit display support anyway, though I may be
    wrong).
    Some other forums seem to say it comes from macOS invalidating now more
    than it should (i.e. the whole area instead of only the changed area)
    and this NSViewUsesAutomaticLayerBackingStores flag would disable this
    behavior. It might be one of these reasons, the other or both. This is
    anyway a good first start for future contributors.
    
    (cherry picked from commit 4f9b7373e6f81f540b39f1282a6fe6c9e5da3a83)

 app/gui/gui.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/app/gui/gui.c b/app/gui/gui.c
index 6fd6b959d3..e5928ebdb9 100644
--- a/app/gui/gui.c
+++ b/app/gui/gui.c
@@ -86,6 +86,7 @@
 #ifdef GDK_WINDOWING_QUARTZ
 #import <AppKit/AppKit.h>
 #include <gtkosxapplication.h>
+#include <gdk/gdkquartz.h>
 
 /* Forward declare since we are building against old SDKs. */
 #if !defined(MAC_OS_X_VERSION_10_12) || \
@@ -275,6 +276,18 @@ gui_init (Gimp     *gimp,
    */
   if ([NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)])
     [NSWindow setAllowsAutomaticWindowTabbing:NO];
+
+  /* MacOS 11 (Big Sur) has added a new, dynamic "accent" as default.
+   * This uses a 10-bit colorspace so every GIMP drawing operation
+   * has the additional cost of an 8-bit (ARGB) to 10-bit conversion.
+   * Let's disable this mode to regain the lost performance.
+   */
+  if (gdk_quartz_osx_version () >= GDK_OSX_BIG_SUR)
+    {
+      NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+      [userDefaults setBool: NO forKey:@"NSViewUsesAutomaticLayerBackingStores"];
+    }
+
 #endif /* GDK_WINDOWING_QUARTZ */
 
   gimp_dnd_init (gimp);


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