[gimp] app: use gimp_canvas_item_hit() in gimp_transform_tool_oper_update()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: use gimp_canvas_item_hit() in gimp_transform_tool_oper_update()
- Date: Mon, 28 Mar 2011 16:56:24 +0000 (UTC)
commit 365902b582731b64ff329cdb9df9b0c746449fee
Author: Michael Natterer <mitch gimp org>
Date: Mon Mar 28 18:55:08 2011 +0200
app: use gimp_canvas_item_hit() in gimp_transform_tool_oper_update()
so all the extents calculation and parameter passing is not
duplicated for the first time \o/
app/tools/gimptransformtool.c | 58 +++++++---------------------------------
1 files changed, 10 insertions(+), 48 deletions(-)
---
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index c4a052d..ac7c180 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -522,56 +522,23 @@ gimp_transform_tool_oper_update (GimpTool *tool,
if (tr_tool->use_mid_handles)
{
- gdouble x, y;
-
- x = (tr_tool->tx1 + tr_tool->tx2) / 2.0;
- y = (tr_tool->ty1 + tr_tool->ty2) / 2.0;
-
- if (gimp_draw_tool_on_handle (draw_tool, display,
- coords->x, coords->y,
- GIMP_HANDLE_SQUARE,
- x, y,
- tr_tool->handle_w, tr_tool->handle_h,
- GIMP_HANDLE_ANCHOR_CENTER))
+ if (gimp_canvas_item_hit (tr_tool->handles[TRANSFORM_HANDLE_N],
+ coords->x, coords->y))
{
function = TRANSFORM_HANDLE_N;
}
-
- x = (tr_tool->tx2 + tr_tool->tx4) / 2.0;
- y = (tr_tool->ty2 + tr_tool->ty4) / 2.0;
-
- if (gimp_draw_tool_on_handle (draw_tool, display,
- coords->x, coords->y,
- GIMP_HANDLE_SQUARE,
- x, y,
- tr_tool->handle_w, tr_tool->handle_h,
- GIMP_HANDLE_ANCHOR_CENTER))
+ else if (gimp_canvas_item_hit (tr_tool->handles[TRANSFORM_HANDLE_E],
+ coords->x, coords->y))
{
function = TRANSFORM_HANDLE_E;
}
-
- x = (tr_tool->tx3 + tr_tool->tx4) / 2.0;
- y = (tr_tool->ty3 + tr_tool->ty4) / 2.0;
-
- if (gimp_draw_tool_on_handle (draw_tool, display,
- coords->x, coords->y,
- GIMP_HANDLE_SQUARE,
- x, y,
- tr_tool->handle_w, tr_tool->handle_h,
- GIMP_HANDLE_ANCHOR_CENTER))
+ else if (gimp_canvas_item_hit (tr_tool->handles[TRANSFORM_HANDLE_S],
+ coords->x, coords->y))
{
function = TRANSFORM_HANDLE_S;
}
-
- x = (tr_tool->tx3 + tr_tool->tx1) / 2.0;
- y = (tr_tool->ty3 + tr_tool->ty1) / 2.0;
-
- if (gimp_draw_tool_on_handle (draw_tool, display,
- coords->x, coords->y,
- GIMP_HANDLE_SQUARE,
- x, y,
- tr_tool->handle_w, tr_tool->handle_h,
- GIMP_HANDLE_ANCHOR_CENTER))
+ else if (gimp_canvas_item_hit (tr_tool->handles[TRANSFORM_HANDLE_W],
+ coords->x, coords->y))
{
function = TRANSFORM_HANDLE_W;
}
@@ -579,13 +546,8 @@ gimp_transform_tool_oper_update (GimpTool *tool,
}
if (tr_tool->use_center &&
- gimp_draw_tool_on_handle (draw_tool, display,
- coords->x, coords->y,
- GIMP_HANDLE_CIRCLE,
- tr_tool->tcx, tr_tool->tcy,
- MIN (tr_tool->handle_w, tr_tool->handle_h),
- MIN (tr_tool->handle_w, tr_tool->handle_h),
- GIMP_HANDLE_ANCHOR_CENTER))
+ gimp_canvas_item_hit (tr_tool->handles[TRANSFORM_HANDLE_CENTER],
+ coords->x, coords->y))
{
function = TRANSFORM_HANDLE_CENTER;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]