[gimp/gimp-2-10] app: fix transform-tool preview/bounds in show-all mode when transforming entire image
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: fix transform-tool preview/bounds in show-all mode when transforming entire image
- Date: Wed, 4 Sep 2019 17:59:37 +0000 (UTC)
commit 8ed929b2720047c8622df07d442127280ea2c2b4
Author: Ell <ell_se yahoo com>
Date: Wed Sep 4 18:33:47 2019 +0300
app: fix transform-tool preview/bounds in show-all mode when transforming entire image
In the transform tools, when transforming the entire image in show-
all mode, don't crop the preview and the transform bounds to the
size of the canvas.
app/tools/gimptransformgridtool.c | 12 ++++++++++--
app/tools/gimptransformtool.c | 33 ++++++++++++++++++++++++++++-----
2 files changed, 38 insertions(+), 7 deletions(-)
---
diff --git a/app/tools/gimptransformgridtool.c b/app/tools/gimptransformgridtool.c
index 6b2280be81..d7b7db66a4 100644
--- a/app/tools/gimptransformgridtool.c
+++ b/app/tools/gimptransformgridtool.c
@@ -653,6 +653,7 @@ gimp_transform_grid_tool_draw (GimpDrawTool *draw_tool)
GimpTransformGridTool *tg_tool = GIMP_TRANSFORM_GRID_TOOL (draw_tool);
GimpTransformGridOptions *options = GIMP_TRANSFORM_GRID_TOOL_GET_OPTIONS (tool);
GimpTransformOptions *tr_options = GIMP_TRANSFORM_OPTIONS (options);
+ GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
GimpImage *image = gimp_display_get_image (tool->display);
GimpMatrix3 matrix = tr_tool->transform;
GimpCanvasItem *item;
@@ -666,9 +667,16 @@ gimp_transform_grid_tool_draw (GimpDrawTool *draw_tool)
gboolean show_preview;
if (tr_options->type == GIMP_TRANSFORM_TYPE_IMAGE)
- pickable = GIMP_PICKABLE (image);
+ {
+ if (! shell->show_all)
+ pickable = GIMP_PICKABLE (image);
+ else
+ pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
+ }
else
- pickable = GIMP_PICKABLE (tool->drawable);
+ {
+ pickable = GIMP_PICKABLE (tool->drawable);
+ }
show_preview = gimp_transform_grid_options_show_preview (options) &&
tr_tool->transform_valid;
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index e97a437ea7..52bf7f4eb3 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -43,6 +43,7 @@
#include "vectors/gimpvectors.h"
#include "display/gimpdisplay.h"
+#include "display/gimpdisplayshell.h"
#include "widgets/gimpmessagedialog.h"
#include "widgets/gimpmessagebox.h"
@@ -256,6 +257,11 @@ gimp_transform_tool_halt (GimpTransformTool *tr_tool)
{
GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
+ tr_tool->x1 = 0;
+ tr_tool->y1 = 0;
+ tr_tool->x2 = 0;
+ tr_tool->y2 = 0;
+
if (tr_tool->restore_type)
{
g_object_set (options,
@@ -483,6 +489,7 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
GimpDisplay *display)
{
GimpTransformOptions *options;
+ GimpDisplayShell *shell;
GimpImage *image;
gboolean non_empty = TRUE;
@@ -490,6 +497,7 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
image = gimp_display_get_image (display);
+ shell = gimp_display_get_shell (display);
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
@@ -565,10 +573,24 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
break;
case GIMP_TRANSFORM_TYPE_IMAGE:
- tr_tool->x1 = 0;
- tr_tool->y1 = 0;
- tr_tool->x2 = gimp_image_get_width (image);
- tr_tool->y2 = gimp_image_get_height (image);
+ if (! shell->show_all)
+ {
+ tr_tool->x1 = 0;
+ tr_tool->y1 = 0;
+ tr_tool->x2 = gimp_image_get_width (image);
+ tr_tool->y2 = gimp_image_get_height (image);
+ }
+ else
+ {
+ GeglRectangle bounding_box;
+
+ bounding_box = gimp_display_shell_get_bounding_box (shell);
+
+ tr_tool->x1 = bounding_box.x;
+ tr_tool->y1 = bounding_box.y;
+ tr_tool->x2 = bounding_box.x + bounding_box.width;
+ tr_tool->y2 = bounding_box.y + bounding_box.height;
+ }
break;
}
@@ -582,7 +604,8 @@ gimp_transform_tool_recalc_matrix (GimpTransformTool *tr_tool,
g_return_if_fail (GIMP_IS_TRANSFORM_TOOL (tr_tool));
g_return_if_fail (GIMP_IS_DISPLAY (display));
- gimp_transform_tool_bounds (tr_tool, display);
+ if (tr_tool->x1 == tr_tool->x2 && tr_tool->y1 == tr_tool->y2)
+ gimp_transform_tool_bounds (tr_tool, display);
if (GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->recalc_matrix)
GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->recalc_matrix (tr_tool);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]