[gimp] macos: reduce frequency of coordinates refresh
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] macos: reduce frequency of coordinates refresh
- Date: Mon, 7 Feb 2022 13:44:47 +0000 (UTC)
commit 6de9ea7022358e1bbad33ba3cb9e4371ebbcb335
Author: Lukas Oberhuber <lukaso gmail com>
Date: Mon Feb 7 13:44:46 2022 +0000
macos: reduce frequency of coordinates refresh
This change reduces to 3.33 times a second, the updates to the
status bar coordinates widget.
This dramatically improves frame rate on macOS retina displays
because it reduces the frequency of full screen updates which
are triggered by this widget updating and are very slow.
This makes the statusbar refresh changes mac only where the
benefit will be felt keenly, rather than saddling all
platforms with the change.
app/display/gimpstatusbar.c | 24 ++++++++++++++++++++++++
app/display/gimpstatusbar.h | 10 ++++++++++
2 files changed, 34 insertions(+)
---
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index a7b29a633b..052f58d32d 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -1207,8 +1207,32 @@ gimp_statusbar_update_cursor (GimpStatusbar *statusbar,
GimpImage *image;
gchar buffer[CURSOR_LEN];
+#ifdef GDK_WINDOWING_QUARTZ
+ /*
+ * This optimization dramatically improves drawing refresh speed on Macs with retina
+ * displays, which is all macbook pros since 2016 and macbook airs since 2018 and
+ * running Big Sur (released Nov 2020) or higher.
+ * https://gitlab.gnome.org/GNOME/gimp/-/issues/7690
+ */
+ gint64 curr_time = g_get_monotonic_time ();
+#endif
+
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
+#ifdef GDK_WINDOWING_QUARTZ
+ /*
+ * This optimization dramatically improves drawing refresh speed on Macs with retina
+ * displays, which is all macbook pros since 2016 and macbook airs since 2018 and
+ * running Big Sur (released Nov 2020) or higher.
+ * https://gitlab.gnome.org/GNOME/gimp/-/issues/7690
+ */
+ /* only redraw max every 100ms */
+ if (curr_time - statusbar->last_frame_time < 1000 * 300)
+ return;
+
+ statusbar->last_frame_time = curr_time;
+#endif
+
shell = statusbar->shell;
image = gimp_display_get_image (shell->display);
diff --git a/app/display/gimpstatusbar.h b/app/display/gimpstatusbar.h
index 0caeafb10d..c1d9f78630 100644
--- a/app/display/gimpstatusbar.h
+++ b/app/display/gimpstatusbar.h
@@ -44,6 +44,16 @@ struct _GimpStatusbar
GHashTable *context_ids;
guint seq_context_id;
+#ifdef GDK_WINDOWING_QUARTZ
+ /*
+ * This optimization dramatically improves drawing refresh speed on Macs with retina
+ * displays, which is all macbook pros since 2016 and macbook airs since 2018 and
+ * running Big Sur (released Nov 2020) or higher.
+ * https://gitlab.gnome.org/GNOME/gimp/-/issues/7690
+ */
+ gint64 last_frame_time;
+#endif
+
GdkPixbuf *icon;
GHashTable *icon_hash;
gint icon_space_width;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]