[gimp/soc-2012-unified-transformation] transformtool: Use the same method for frompivot for shearing as everything else
- From: Mikael Magnusson <mikachu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2012-unified-transformation] transformtool: Use the same method for frompivot for shearing as everything else
- Date: Mon, 20 Aug 2012 14:43:13 +0000 (UTC)
commit 4c22ed8128be280dafec3a0d0944684b06a0e0cf
Author: Mikael Magnusson <mikachu src gnome org>
Date: Mon Aug 20 16:42:26 2012 +0200
transformtool: Use the same method for frompivot for shearing as everything else
app/tools/gimpunifiedtransformtool.c | 25 ++++++++-----------------
1 files changed, 8 insertions(+), 17 deletions(-)
---
diff --git a/app/tools/gimpunifiedtransformtool.c b/app/tools/gimpunifiedtransformtool.c
index 07487c8..3074028 100644
--- a/app/tools/gimpunifiedtransformtool.c
+++ b/app/tools/gimpunifiedtransformtool.c
@@ -822,7 +822,6 @@ gimp_unified_transform_tool_motion (GimpTransformTool *transform_tool)
function == TRANSFORM_HANDLE_W_S)
{
gint this_l, this_r, opp_l, opp_r;
- GimpVector2 po, zero = { .x = 0.0, .y = 0.0 };
/* set up indices for this edge and the opposite edge */
if (function == TRANSFORM_HANDLE_N_S) {
@@ -838,11 +837,6 @@ gimp_unified_transform_tool_motion (GimpTransformTool *transform_tool)
opp_l = 3 - this_l;
opp_r = 3 - this_r;
- if (options->frompivot_shear)
- po = vectorsubtract (zero, d);
- else
- po = zero;
-
if (options->constrain_shear)
{
/* restrict to movement along the side */
@@ -851,20 +845,17 @@ gimp_unified_transform_tool_motion (GimpTransformTool *transform_tool)
d = vectorproject (d, side);
}
- if (options->constrain_shear && options->frompivot_shear)
+ newpos[this_l] = vectoradd (oldpos[this_l], d);
+ newpos[this_r] = vectoradd (oldpos[this_r], d);
+
+ if (options->frompivot_shear && transform_is_convex (newpos) && transform_is_convex (oldpos))
{
- /* restrict to movement along the opposite side */
- GimpVector2 side = vectorsubtract (oldpos[opp_r], oldpos[opp_l]);
+ GimpVector2 delta = getpivotdelta (transform_tool, oldpos, newpos, pivot);
+ for (i = 0; i < 4; i++)
+ newpos[i] = vectorsubtract (newpos[i], delta);
- po = vectorproject (po, side);
+ fixedpivot = TRUE;
}
-
- /* We have to set opp unconditionally, or the opposite edge will stay
- * in place when you toggle the frompivot constraint during an action */
- newpos[this_l] = vectoradd (oldpos[this_l], d);
- newpos[this_r] = vectoradd (oldpos[this_r], d);
- newpos[opp_l] = vectoradd (oldpos[opp_l], po);
- newpos[opp_r] = vectoradd (oldpos[opp_r], po);
}
/* perspective transform */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]