[gimp] app: reduce redraws on statusbar
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: reduce redraws on statusbar
- Date: Wed, 2 Feb 2022 21:28:40 +0000 (UTC)
commit b4099de8cd22ef474ed76d5413b604bb7a046569
Author: Lukas Oberhuber <lukaso gmail com>
Date: Wed Jan 19 19:46:34 2022 +0000
app: reduce redraws on statusbar
This change reduces redraws due to spurious status updates.
Before this change, the status would be unset, then set again to the
same value it was previously. Each turn around setting and unsetting
causes a redraw.
On macOS this redraw causes a full screen redraw. With this
optimization, when the status message is unchanged, no redraw occurs.
This is because `gimp_tool_push_status` checks to see if the message
has changed.
app/tools/gimppainttool.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c
index cfa01541f3..52bd340553 100644
--- a/app/tools/gimppainttool.c
+++ b/app/tools/gimppainttool.c
@@ -607,6 +607,7 @@ gimp_paint_tool_oper_update (GimpTool *tool,
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
GList *drawables;
+ gchar *status = NULL;
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
@@ -621,8 +622,6 @@ gimp_paint_tool_oper_update (GimpTool *tool,
draw_tool->display != display)
gimp_draw_tool_stop (draw_tool);
- gimp_tool_pop_status (tool, display);
-
if (tool->display &&
tool->display != display &&
gimp_display_get_image (tool->display) == image)
@@ -642,7 +641,6 @@ gimp_paint_tool_oper_update (GimpTool *tool,
(g_list_length (drawables) > 1 && paint_tool->can_multi_paint)) &&
proximity)
{
- gchar *status;
gboolean constrain_mask = gimp_get_constrain_behavior_mask ();
core->cur_coords = *coords;
@@ -703,8 +701,6 @@ gimp_paint_tool_oper_update (GimpTool *tool,
NULL);
paint_tool->draw_line = FALSE;
}
- gimp_tool_push_status (tool, display, "%s", status);
- g_free (status);
paint_tool->cursor_x = core->cur_coords.x;
paint_tool->cursor_y = core->cur_coords.y;
@@ -717,6 +713,16 @@ gimp_paint_tool_oper_update (GimpTool *tool,
gimp_draw_tool_stop (draw_tool);
}
+ if (status != NULL)
+ {
+ gimp_tool_push_status (tool, display, "%s", status);
+ g_free (status);
+ }
+ else
+ {
+ gimp_tool_pop_status (tool, display);
+ }
+
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
display);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]