[gimp] Bug 315051 - Image preview in transforms keeps original version visible
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 315051 - Image preview in transforms keeps original version visible
- Date: Wed, 5 Apr 2017 22:19:11 +0000 (UTC)
commit f03051143831b9053c6d6c791886425f8bc688f8
Author: Michael Natterer <mitch gimp org>
Date: Thu Apr 6 00:15:42 2017 +0200
Bug 315051 - Image preview in transforms keeps original version visible
If the transformed item is a layer, and we are transforming the entire
layer (if there is now selection), hide the original layer during the
interactive transform. Based on a 2.8 patch from saulgoode.
app/tools/gimptransformtool.c | 43 +++++++++++++++++++++++++++++++++++++++++
app/tools/gimptransformtool.h | 3 ++
2 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 4b7366e..6059573 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -42,6 +42,7 @@
#include "core/gimpitem-linked.h"
#include "core/gimplayer.h"
#include "core/gimpprogress.h"
+#include "core/gimpprojection.h"
#include "core/gimptoolinfo.h"
#include "core/gimp-transform-utils.h"
#include "core/gimp-utils.h"
@@ -174,6 +175,9 @@ static GimpItem *gimp_transform_tool_check_active_item (GimpTransformTool
GimpImage *display,
gboolean invisible_layer_ok,
GError **error);
+static void gimp_transform_tool_hide_active_item (GimpTransformTool *tr_tool,
+ GimpItem *item);
+static void gimp_transform_tool_show_active_item (GimpTransformTool *tr_tool);
static TransInfo * trans_info_new (void);
static void trans_info_free (TransInfo *info);
@@ -300,6 +304,8 @@ gimp_transform_tool_initialize (GimpTool *tool,
tool->display = display;
tool->drawable = drawable;
+ gimp_transform_tool_hide_active_item (tr_tool, item);
+
/* Initialize the transform tool dialog */
if (! tr_tool->gui)
gimp_transform_tool_dialog (tr_tool);
@@ -1479,6 +1485,8 @@ gimp_transform_tool_halt (GimpTransformTool *tr_tool)
tr_tool->prev_trans_info = NULL;
}
+ gimp_transform_tool_show_active_item (tr_tool);
+
tool->display = NULL;
tool->drawable = NULL;
}
@@ -1877,6 +1885,41 @@ gimp_transform_tool_check_active_item (GimpTransformTool *tr_tool,
return item;
}
+static void
+gimp_transform_tool_hide_active_item (GimpTransformTool *tr_tool,
+ GimpItem *item)
+{
+ GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
+ GimpDisplay *display = GIMP_TOOL (tr_tool)->display;
+ GimpImage *image = gimp_display_get_image (display);
+
+ if (options->type == GIMP_TRANSFORM_TYPE_LAYER &&
+ GIMP_IS_LAYER (item) &&
+ gimp_item_get_visible (item) &&
+ gimp_channel_is_empty (gimp_image_get_mask (image)))
+ {
+ tr_tool->hidden_item = item;
+ gimp_item_set_visible (item, FALSE, FALSE);
+
+ gimp_projection_flush (gimp_image_get_projection (image));
+ }
+}
+
+static void
+gimp_transform_tool_show_active_item (GimpTransformTool *tr_tool)
+{
+ if (tr_tool->hidden_item)
+ {
+ GimpDisplay *display = GIMP_TOOL (tr_tool)->display;
+ GimpImage *image = gimp_display_get_image (display);
+
+ gimp_item_set_visible (tr_tool->hidden_item, TRUE, FALSE);
+ tr_tool->hidden_item = NULL;
+
+ gimp_image_flush (image);
+ }
+}
+
static TransInfo *
trans_info_new (void)
{
diff --git a/app/tools/gimptransformtool.h b/app/tools/gimptransformtool.h
index 4d78099..df4e0e2 100644
--- a/app/tools/gimptransformtool.h
+++ b/app/tools/gimptransformtool.h
@@ -110,6 +110,9 @@ struct _GimpTransformTool
GList *redo_list; /* list of all undone states,
NULL when nothing undone */
+ GimpItem *hidden_item; /* the item that was hidden during
+ the transform */
+
TransformAction function; /* current tool activity */
gboolean use_grid; /* does the tool use the grid */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]