[gimp/soc-2012-unified-transformation: 17/21] transformtool: remove unneeded old stuff, cleanup
- From: Mikael Magnusson <mikachu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2012-unified-transformation: 17/21] transformtool: remove unneeded old stuff, cleanup
- Date: Sat, 16 Jun 2012 12:41:08 +0000 (UTC)
commit 80831e3749d87cbbb08ff33a2cf161119022f04d
Author: Mikael Magnusson <mikachu src gnome org>
Date: Fri Jun 15 09:43:54 2012 +0200
transformtool: remove unneeded old stuff, cleanup
app/tools/gimpunifiedtransformationtool.c | 113 +----------------------------
1 files changed, 4 insertions(+), 109 deletions(-)
---
diff --git a/app/tools/gimpunifiedtransformationtool.c b/app/tools/gimpunifiedtransformationtool.c
index 36a7fda..12f195f 100644
--- a/app/tools/gimpunifiedtransformationtool.c
+++ b/app/tools/gimpunifiedtransformationtool.c
@@ -742,8 +742,8 @@ static inline GimpVector2 shearvector(GimpVector2 p, gdouble factor) {
static void
gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
{
- gdouble diff_x = transform_tool->curx - transform_tool->lastx,
- diff_y = transform_tool->cury - transform_tool->lasty;
+ gdouble dx = transform_tool->curx - transform_tool->mousex;
+ gdouble dy = transform_tool->cury - transform_tool->mousey;
gdouble *x[4], *y[4], px[5], py[5], *pivot_x, *pivot_y, ppivot_x, ppivot_y;
gint i;
gboolean horizontal = FALSE;
@@ -770,6 +770,7 @@ gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
py[2] = (*transform_tool->prev_trans_info)[Y2];
py[3] = (*transform_tool->prev_trans_info)[Y3];
+ /* put center point in this array too */
px[4] = (px[0] + px[1] + px[2] + px[3]) / 4.;
py[4] = (py[0] + py[1] + py[2] + py[3]) / 4.;
@@ -782,8 +783,6 @@ gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
/* move */
if (function == TRANSFORM_HANDLE_CENTER)
{
- gdouble dx = transform_tool->curx - transform_tool->mousex;
- gdouble dy = transform_tool->cury - transform_tool->mousey;
if (constrain)
{
/* snap to 45 degree vectors from starting point */
@@ -839,9 +838,6 @@ gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
/* move rotation axis */
if (function == TRANSFORM_HANDLE_PIVOT)
{
- gdouble dx = transform_tool->curx - transform_tool->mousex;
- gdouble dy = transform_tool->cury - transform_tool->mousey;
-
gint screenx, screeny;
if (constrain)
@@ -904,8 +900,6 @@ gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
function == TRANSFORM_HANDLE_SE_P ||
function == TRANSFORM_HANDLE_SW_P)
{
- gdouble dx = transform_tool->curx - transform_tool->mousex;
- gdouble dy = transform_tool->cury - transform_tool->mousey;
gint this, left, right, opposite;
/* 1: northwest, 2: northeast, 3: southwest, 4: southeast */
@@ -964,108 +958,9 @@ gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
return;
}
- if (options->alternate)
- {
- gdouble *x0, *x1, *y0, *y1;
- gboolean moveedge = FALSE;
-
- switch (function)
- {
- case TRANSFORM_HANDLE_W:
- x0 = x[0]; y0 = y[0];
- x1 = x[2]; y1 = y[2];
- moveedge = TRUE;
- break;
-
- case TRANSFORM_HANDLE_S:
- x0 = x[2]; y0 = y[2];
- x1 = x[3]; y1 = y[3];
- moveedge = TRUE;
- break;
-
- case TRANSFORM_HANDLE_N:
- x0 = x[0]; y0 = y[0];
- x1 = x[1]; y1 = y[1];
- moveedge = TRUE;
- break;
-
- case TRANSFORM_HANDLE_E:
- x0 = x[1]; y0 = y[1];
- x1 = x[3]; y1 = y[3];
- moveedge = TRUE;
- break;
-
- case TRANSFORM_HANDLE_NW:
- *x[0] += diff_x;
- *y[0] += diff_y;
- return;
-
- case TRANSFORM_HANDLE_NE:
- *x[1] += diff_x;
- *y[1] += diff_y;
- return;
-
- case TRANSFORM_HANDLE_SW:
- *x[2] += diff_x;
- *y[2] += diff_y;
- return;
-
- case TRANSFORM_HANDLE_SE:
- *x[3] += diff_x;
- *y[3] += diff_y;
- return;
-
- default:
- break;
- }
- if (moveedge)
- {
- *x0 += diff_x;
- *x1 += diff_x;
- *y0 += diff_y;
- *y1 += diff_y;
- return;
- }
- }
-
+ /* old stuff */
switch (function)
{
- case TRANSFORM_HANDLE_NW:
- case TRANSFORM_HANDLE_NE:
- case TRANSFORM_HANDLE_SW:
- case TRANSFORM_HANDLE_SE:
- {
- GimpVector2 m = { .x = transform_tool->curx, .y = transform_tool->cury };
- GimpVector2 p = { .x = transform_tool->mousex, .y = transform_tool->mousey };
- GimpVector2 c = { .x = *pivot_x, .y = *pivot_y };
- gdouble angle = calcangle(vectorsubtract(m, c), vectorsubtract(p, c));
- for (i = 0; i < 4; i++) {
- p.x = px[i]; p.y = py[i];
- m = vectoradd(c, rotate2d(vectorsubtract(p, c), angle));
- *x[i] = m.x;
- *y[i] = m.y;
- }
- return;
- }
- case TRANSFORM_HANDLE_CENTER:
- if (constrain) {
- diff_y = diff_x;
- }
- *x[0] += diff_x;
- *y[0] += diff_y;
- *x[1] += diff_x;
- *y[1] += diff_y;
- *x[2] += diff_x;
- *y[2] += diff_y;
- *x[3] += diff_x;
- *y[3] += diff_y;
- break;
-
- case TRANSFORM_HANDLE_PIVOT:
- *pivot_x += diff_x;
- *pivot_y += diff_y;
- break;
-
case TRANSFORM_HANDLE_E:
case TRANSFORM_HANDLE_W:
horizontal = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]