From 042eddfb0a0d0491ac9ed1a97771ccac8e8a4e7d Mon Sep 17 00:00:00 2001 From: Lukas Oberhuber Date: Sun, 26 Jun 2022 13:21:16 +0100 Subject: [PATCH] canvas: remove limits on ruler & statusbar updates This removes rate limiting of ruler and statusbar updates which were required to get acceptable performance on mac for drawing on the canvas. This requires the latest changes on in Gtk 3.24 to be incorporated. --- app/display/gimpstatusbar.c | 21 --------------------- app/display/gimpstatusbar.h | 9 --------- libgimpwidgets/gimpruler.c | 35 ----------------------------------- 3 files changed, 65 deletions(-) diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c index 9b949e0a96..cd604d11cf 100644 --- a/app/display/gimpstatusbar.c +++ b/app/display/gimpstatusbar.c @@ -1815,27 +1815,6 @@ gimp_statusbar_queue_pos_redraw (gpointer data) shell = statusbar->shell; image = gimp_display_get_image (shell->display); -#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 333ms and only redraw when the other two decorations aren't - * redrawing (cursor_label, horizontal and vertical rulers). This will keep the draw - * rects of limited size. - */ - gint64 curr_time = g_get_monotonic_time (); - gint64 mod_time = curr_time % G_TIME_SPAN_SECOND; - gint timeslice_num = mod_time / (G_TIME_SPAN_SECOND / 9) % 3; - - if (curr_time - statusbar->last_frame_time < G_TIME_SPAN_SECOND / 3 || timeslice_num != 0) - return G_SOURCE_CONTINUE; - - statusbar->last_frame_time = curr_time; -#endif - if (image) { image_width = gimp_image_get_width (image); diff --git a/app/display/gimpstatusbar.h b/app/display/gimpstatusbar.h index 50269161d2..3cab648dda 100644 --- a/app/display/gimpstatusbar.h +++ b/app/display/gimpstatusbar.h @@ -44,15 +44,6 @@ 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 guint statusbar_pos_redraw_idle_id; gchar *cursor_string_todraw; gchar *cursor_string_last; diff --git a/libgimpwidgets/gimpruler.c b/libgimpwidgets/gimpruler.c index 670ced1e7d..27e9063951 100644 --- a/libgimpwidgets/gimpruler.c +++ b/libgimpwidgets/gimpruler.c @@ -77,16 +77,6 @@ struct _GimpRulerPrivate PangoLayout *layout; GList *track_widgets; - -#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 }; #define GET_PRIVATE(obj) (((GimpRuler *) (obj))->priv) @@ -1274,31 +1264,6 @@ gimp_ruler_idle_queue_pos_redraw (gpointer data) GimpRuler *ruler = data; GimpRulerPrivate *priv = GET_PRIVATE (ruler); -#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 333ms and only redraw when the other two decorations aren't - * redrawing (cursor_label, horizontal and vertical rulers). This will keep the draw - * rects of limited size. - */ - gint64 curr_time = g_get_monotonic_time (); - gint64 mod_time = curr_time % G_TIME_SPAN_SECOND; - gint timeslice_num = mod_time / (G_TIME_SPAN_SECOND / 9) % 3; - - if (curr_time - priv->last_frame_time < G_TIME_SPAN_SECOND / 3) - return G_SOURCE_CONTINUE; - if (priv->orientation == GTK_ORIENTATION_HORIZONTAL && timeslice_num != 1) - return G_SOURCE_CONTINUE; - if (priv->orientation == GTK_ORIENTATION_VERTICAL && timeslice_num != 2) - return G_SOURCE_CONTINUE; - - priv->last_frame_time = curr_time; -#endif - gimp_ruler_queue_pos_redraw (ruler); /*