[gimp/gimp-2-10] app: in GimpTransformGridTool, avoid unnecessarily flushing image when pushing undo
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: in GimpTransformGridTool, avoid unnecessarily flushing image when pushing undo
- Date: Mon, 6 Jan 2020 21:19:29 +0000 (UTC)
commit dab1eb021ed4436d5130287ecd1832c187f7d84b
Author: Ell <ell_se yahoo com>
Date: Mon Jan 6 11:57:17 2020 +0200
app: in GimpTransformGridTool, avoid unnecessarily flushing image when pushing undo
In gimp_transform_grid_tool_push_internal_undo(), only flush the
image when undo/redo availability for the tool changes, instead of
for every undo step. This speeds things up when many undo steps
are pushed in succession, which usually happens when using the tool
GUI.
app/tools/gimptransformgridtool.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/app/tools/gimptransformgridtool.c b/app/tools/gimptransformgridtool.c
index d7b7db66a4..b1300a5115 100644
--- a/app/tools/gimptransformgridtool.c
+++ b/app/tools/gimptransformgridtool.c
@@ -1614,6 +1614,10 @@ gimp_transform_grid_tool_push_internal_undo (GimpTransformGridTool *tg_tool)
if (! trans_infos_equal (undo_info->trans_infos, tg_tool->trans_infos))
{
GimpTransformOptions *tr_options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tg_tool);
+ gboolean flush = FALSE;
+
+ if (tg_tool->undo_list->next == NULL)
+ flush = TRUE;
undo_info = undo_info_new ();
undo_info->direction = tr_options->direction;
@@ -1625,12 +1629,22 @@ gimp_transform_grid_tool_push_internal_undo (GimpTransformGridTool *tg_tool)
/* If we undid anything and started interacting, we have to
* discard the redo history
*/
- g_list_free_full (tg_tool->redo_list, (GDestroyNotify) undo_info_free);
- tg_tool->redo_list = NULL;
+ if (tg_tool->redo_list)
+ {
+ g_list_free_full (tg_tool->redo_list,
+ (GDestroyNotify) undo_info_free);
+ tg_tool->redo_list = NULL;
+
+ flush = TRUE;
+ }
gimp_transform_grid_tool_update_sensitivity (tg_tool);
/* update the undo actions / menu items */
- gimp_image_flush (gimp_display_get_image (GIMP_TOOL (tg_tool)->display));
+ if (flush)
+ {
+ gimp_image_flush (
+ gimp_display_get_image (GIMP_TOOL (tg_tool)->display));
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]