[gimp] app: use matrix to determine if doing perspective transform in preview
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: use matrix to determine if doing perspective transform in preview
- Date: Tue, 14 Nov 2017 16:25:11 +0000 (UTC)
commit 2e9ab59d19b698fe370e08df770600c9c7df1c60
Author: Ell <ell_se yahoo com>
Date: Tue Nov 14 11:19:42 2017 -0500
app: use matrix to determine if doing perspective transform in preview
In GimpCanvasTransformPreview, use the transform matrix to
determine if we're doing a perspective transform, rather than
relying on a separate property, so that we don't use the slow
perspective path unnecessarily.
Consequently, remove the does_perspective member of
GimpTransformTool, since it's no longer used.
app/display/gimpcanvastransformpreview.c | 22 ++--------------------
app/display/gimpcanvastransformpreview.h | 3 +--
app/tools/gimpdrawtool.c | 6 ++----
app/tools/gimpdrawtool.h | 3 +--
app/tools/gimphandletransformtool.c | 3 +--
app/tools/gimpperspectivetool.c | 3 +--
app/tools/gimptransformtool.c | 3 +--
app/tools/gimptransformtool.h | 4 ----
app/tools/gimpunifiedtransformtool.c | 3 +--
9 files changed, 10 insertions(+), 40 deletions(-)
---
diff --git a/app/display/gimpcanvastransformpreview.c b/app/display/gimpcanvastransformpreview.c
index 6d592a1..c474677 100644
--- a/app/display/gimpcanvastransformpreview.c
+++ b/app/display/gimpcanvastransformpreview.c
@@ -57,7 +57,6 @@ enum
PROP_Y1,
PROP_X2,
PROP_Y2,
- PROP_PERSPECTIVE,
PROP_OPACITY
};
@@ -70,7 +69,6 @@ struct _GimpCanvasTransformPreviewPrivate
GimpMatrix3 transform;
gdouble x1, y1;
gdouble x2, y2;
- gboolean perspective;
gdouble opacity;
};
@@ -216,12 +214,6 @@ gimp_canvas_transform_preview_class_init (GimpCanvasTransformPreviewClass *klass
0.0,
GIMP_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_PERSPECTIVE,
- g_param_spec_boolean ("perspective",
- NULL, NULL,
- FALSE,
- GIMP_PARAM_READWRITE));
-
g_object_class_install_property (object_class, PROP_OPACITY,
g_param_spec_double ("opacity",
NULL, NULL,
@@ -277,10 +269,6 @@ gimp_canvas_transform_preview_set_property (GObject *object,
private->y2 = g_value_get_double (value);
break;
- case PROP_PERSPECTIVE:
- private->perspective = g_value_get_boolean (value);
- break;
-
case PROP_OPACITY:
private->opacity = g_value_get_double (value);
break;
@@ -309,10 +297,6 @@ gimp_canvas_transform_preview_get_property (GObject *object,
g_value_set_boxed (value, &private->transform);
break;
- case PROP_PERSPECTIVE:
- g_value_set_boolean (value, private->perspective);
- break;
-
case PROP_X1:
g_value_set_double (value, private->x1);
break;
@@ -445,7 +429,7 @@ gimp_canvas_transform_preview_draw (GimpCanvasItem *item,
&mask_offx, &mask_offy);
}
- if (private->perspective)
+ if (! gimp_matrix3_is_affine (&private->transform))
{
/* approximate perspective transform by subdivision
*
@@ -575,8 +559,7 @@ gimp_canvas_transform_preview_new (GimpDisplayShell *shell,
gdouble x1,
gdouble y1,
gdouble x2,
- gdouble y2,
- gboolean perspective)
+ gdouble y2)
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@@ -590,7 +573,6 @@ gimp_canvas_transform_preview_new (GimpDisplayShell *shell,
"y1", y1,
"x2", x2,
"y2", y2,
- "perspective", perspective,
NULL);
}
diff --git a/app/display/gimpcanvastransformpreview.h b/app/display/gimpcanvastransformpreview.h
index a27b0c8..62f3d9f 100644
--- a/app/display/gimpcanvastransformpreview.h
+++ b/app/display/gimpcanvastransformpreview.h
@@ -55,8 +55,7 @@ GimpCanvasItem * gimp_canvas_transform_preview_new (GimpDisplayShell *shel
gdouble x1,
gdouble y1,
gdouble x2,
- gdouble y2,
- gboolean perspective);
+ gdouble y2);
#endif /* __GIMP_CANVAS_TRANSFORM_PREVIEW_H__ */
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index 3ab5886..8236615 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -1167,8 +1167,7 @@ gimp_draw_tool_add_transform_preview (GimpDrawTool *draw_tool,
gdouble x1,
gdouble y1,
gdouble x2,
- gdouble y2,
- gboolean perspective)
+ gdouble y2)
{
GimpCanvasItem *item;
@@ -1178,8 +1177,7 @@ gimp_draw_tool_add_transform_preview (GimpDrawTool *draw_tool,
item = gimp_canvas_transform_preview_new (gimp_display_get_shell (draw_tool->display),
drawable, transform,
- x1, y1, x2, y2,
- perspective);
+ x1, y1, x2, y2);
gimp_draw_tool_add_preview (draw_tool, item);
g_object_unref (item);
diff --git a/app/tools/gimpdrawtool.h b/app/tools/gimpdrawtool.h
index 8a8f07f..2a15dc0 100644
--- a/app/tools/gimpdrawtool.h
+++ b/app/tools/gimpdrawtool.h
@@ -150,8 +150,7 @@ GimpCanvasItem * gimp_draw_tool_add_transform_preview(GimpDrawTool *draw_too
gdouble x1,
gdouble y1,
gdouble x2,
- gdouble y2,
- gboolean perspective);
+ gdouble y2);
GimpCanvasItem * gimp_draw_tool_add_handle (GimpDrawTool *draw_tool,
GimpHandleType type,
diff --git a/app/tools/gimphandletransformtool.c b/app/tools/gimphandletransformtool.c
index 3d6ec40..531620a 100644
--- a/app/tools/gimphandletransformtool.c
+++ b/app/tools/gimphandletransformtool.c
@@ -143,8 +143,7 @@ gimp_handle_transform_tool_init (GimpHandleTransformTool *ht_tool)
{
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (ht_tool);
- tr_tool->progress_text = _("Handle transformation");
- tr_tool->does_perspective = TRUE;
+ tr_tool->progress_text = _("Handle transformation");
ht_tool->saved_handle_mode = GIMP_HANDLE_MODE_ADD_TRANSFORM;
}
diff --git a/app/tools/gimpperspectivetool.c b/app/tools/gimpperspectivetool.c
index 5b7a55d..a6a6aad 100644
--- a/app/tools/gimpperspectivetool.c
+++ b/app/tools/gimpperspectivetool.c
@@ -113,8 +113,7 @@ gimp_perspective_tool_init (GimpPerspectiveTool *perspective_tool)
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_PERSPECTIVE);
- tr_tool->progress_text = _("Perspective transformation");
- tr_tool->does_perspective = TRUE;
+ tr_tool->progress_text = _("Perspective transformation");
}
static void
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 71a5a17..35a9294 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -657,8 +657,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
tr_tool->x1,
tr_tool->y1,
tr_tool->x2,
- tr_tool->y2,
- tr_tool->does_perspective);
+ tr_tool->y2);
g_object_add_weak_pointer (G_OBJECT (tr_tool->preview),
(gpointer) &tr_tool->preview);
diff --git a/app/tools/gimptransformtool.h b/app/tools/gimptransformtool.h
index fb85de0..a1ab98f 100644
--- a/app/tools/gimptransformtool.h
+++ b/app/tools/gimptransformtool.h
@@ -63,10 +63,6 @@ struct _GimpTransformTool
GimpItem *hidden_item; /* the item that was hidden during
the transform */
- gboolean does_perspective; /* does the tool do non-affine
- * transformations
- */
-
GimpToolWidget *widget;
GimpToolWidget *grab_widget;
GimpCanvasItem *preview;
diff --git a/app/tools/gimpunifiedtransformtool.c b/app/tools/gimpunifiedtransformtool.c
index 2d1a58d..a5429b9 100644
--- a/app/tools/gimpunifiedtransformtool.c
+++ b/app/tools/gimpunifiedtransformtool.c
@@ -110,8 +110,7 @@ gimp_unified_transform_tool_init (GimpUnifiedTransformTool *unified_tool)
{
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (unified_tool);
- tr_tool->progress_text = _("Unified transform");
- tr_tool->does_perspective = TRUE;
+ tr_tool->progress_text = _("Unified transform");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]