[gimp/blend-tool-fun: 2/9] app: Remove last_{x,	y} from struct _GimpBlendTool
- From: Michael Henning <mhenning src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gimp/blend-tool-fun: 2/9] app: Remove last_{x,	y} from struct _GimpBlendTool
- Date: Wed, 25 Jun 2014 20:41:27 +0000 (UTC)
commit 93bfe758af86358ecd0580abe89f8ae97eed4244
Author: Michael Henning <drawoc darkrefraction com>
Date:   Sun Jun 8 15:10:20 2014 -0400
    app: Remove last_{x,y} from struct _GimpBlendTool
    
    and use local variables instead.
 app/tools/gimpblendtool.c |   15 ++++++++-------
 app/tools/gimpblendtool.h |    2 --
 2 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c
index 5ed1e39..0acc640 100644
--- a/app/tools/gimpblendtool.c
+++ b/app/tools/gimpblendtool.c
@@ -272,8 +272,8 @@ gimp_blend_tool_button_press (GimpTool            *tool,
 {
   GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
 
-  blend_tool->last_x = blend_tool->mouse_x = coords->x;
-  blend_tool->last_y = blend_tool->mouse_y = coords->y;
+  blend_tool->mouse_x = coords->x;
+  blend_tool->mouse_y = coords->y;
 
   if (tool->display && display != tool->display)
     {
@@ -344,14 +344,18 @@ gimp_blend_tool_motion (GimpTool         *tool,
 {
   GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
 
+  /* Save the mouse coordinates from last call */
+  gdouble last_x = blend_tool->mouse_x;
+  gdouble last_y = blend_tool->mouse_y;
+
   blend_tool->mouse_x = coords->x;
   blend_tool->mouse_y = coords->y;
 
   /* Move the whole line if alt is pressed */
   if (state & GDK_MOD1_MASK)
     {
-      gdouble dx = blend_tool->last_x - coords->x;
-      gdouble dy = blend_tool->last_y - coords->y;
+      gdouble dx = last_x - coords->x;
+      gdouble dy = last_y - coords->y;
 
       blend_tool->start_x -= dx;
       blend_tool->start_y -= dy;
@@ -368,9 +372,6 @@ gimp_blend_tool_motion (GimpTool         *tool,
   gimp_tool_pop_status (tool, display);
   gimp_blend_tool_push_status (blend_tool, state, display);
 
-  blend_tool->last_x = coords->x;
-  blend_tool->last_y = coords->y;
-
   gimp_blend_tool_update_items (blend_tool);
 }
 
diff --git a/app/tools/gimpblendtool.h b/app/tools/gimpblendtool.h
index 59b5253..ac94303 100644
--- a/app/tools/gimpblendtool.h
+++ b/app/tools/gimpblendtool.h
@@ -53,8 +53,6 @@ struct _GimpBlendTool
   gdouble         end_x;      /*  ending x coord    */
   gdouble         end_y;      /*  ending y coord    */
 
-  gdouble         last_x;     /*  last x coord      */
-  gdouble         last_y;     /*  last y coord      */
   gdouble         mouse_x;    /*  pointer x coord   */
   gdouble         mouse_y;    /*  pointer y coord   */
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]