From 4d0c75032746caf2b72a7bc1c09635b2f4b7e4d8 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Thu, 23 Sep 2010 09:45:23 +0200 Subject: [PATCH] app: get rid of "gboolean use_offsets" in the draw tool and always pass image coordinates. Transform the coords manually in the very few places which passed TRUE. --- app/tools/gimpaligntool.c | 22 +++-- app/tools/gimpblendtool.c | 9 +- app/tools/gimpbrushtool.c | 6 +- app/tools/gimpcolortool.c | 9 +- app/tools/gimpdrawtool.c | 118 ++++++++++----------------- app/tools/gimpdrawtool.h | 36 +++----- app/tools/gimpeditselectiontool.c | 47 +++++------ app/tools/gimpellipseselecttool.c | 3 +- app/tools/gimpforegroundselecttool.c | 6 +- app/tools/gimpfreeselecttool.c | 7 +- app/tools/gimpiscissorstool.c | 35 +++----- app/tools/gimpmagnifytool.c | 6 +- app/tools/gimpmeasuretool.c | 21 ++--- app/tools/gimppainttool.c | 31 +++---- app/tools/gimpperspectiveclonetool.c | 27 ++---- app/tools/gimprectangleselecttool.c | 12 +-- app/tools/gimprectangletool.c | 79 ++++++++---------- app/tools/gimpsourcetool.c | 3 +- app/tools/gimptexttool.c | 17 ++-- app/tools/gimptransformtool.c | 68 ++++++--------- app/tools/gimpvectortool.c | 22 +++-- 21 files changed, 235 insertions(+), 349 deletions(-) diff --git a/app/tools/gimpaligntool.c b/app/tools/gimpaligntool.c index 244a5fe37c..9b84f03e91 100644 --- a/app/tools/gimpaligntool.c +++ b/app/tools/gimpaligntool.c @@ -666,10 +666,8 @@ gimp_align_tool_draw (GimpDrawTool *draw_tool) w = MAX (align_tool->x1, align_tool->x0) - x; h = MAX (align_tool->y1, align_tool->y0) - y; - gimp_draw_tool_draw_rectangle (draw_tool, - FALSE, - x, y,w, h, - FALSE); + gimp_draw_tool_draw_rectangle (draw_tool, FALSE, + x, y, w, h); for (list = align_tool->selected_objects; list; @@ -701,16 +699,16 @@ gimp_align_tool_draw (GimpDrawTool *draw_tool) gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_FILLED_SQUARE, x, y, MARKER_WIDTH, MARKER_WIDTH, - GTK_ANCHOR_NORTH_WEST, FALSE); + GTK_ANCHOR_NORTH_WEST); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_FILLED_SQUARE, x + w, y, MARKER_WIDTH, MARKER_WIDTH, - GTK_ANCHOR_NORTH_EAST, FALSE); + GTK_ANCHOR_NORTH_EAST); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_FILLED_SQUARE, x, y + h, MARKER_WIDTH, MARKER_WIDTH, - GTK_ANCHOR_SOUTH_WEST, FALSE); + GTK_ANCHOR_SOUTH_WEST); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_FILLED_SQUARE, x + w, y + h, MARKER_WIDTH, MARKER_WIDTH, - GTK_ANCHOR_SOUTH_EAST, FALSE); + GTK_ANCHOR_SOUTH_EAST); } else if (GIMP_IS_GUIDE (list->data)) { @@ -726,10 +724,10 @@ gimp_align_tool_draw (GimpDrawTool *draw_tool) h = gimp_image_get_height (image); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_FILLED_SQUARE, x, h, MARKER_WIDTH, MARKER_WIDTH, - GTK_ANCHOR_SOUTH, FALSE); + GTK_ANCHOR_SOUTH); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_FILLED_SQUARE, x, 0, MARKER_WIDTH, MARKER_WIDTH, - GTK_ANCHOR_NORTH, FALSE); + GTK_ANCHOR_NORTH); break; case GIMP_ORIENTATION_HORIZONTAL: @@ -737,10 +735,10 @@ gimp_align_tool_draw (GimpDrawTool *draw_tool) w = gimp_image_get_width (image); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_FILLED_SQUARE, w, y, MARKER_WIDTH, MARKER_WIDTH, - GTK_ANCHOR_EAST, FALSE); + GTK_ANCHOR_EAST); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_FILLED_SQUARE, 0, y, MARKER_WIDTH, MARKER_WIDTH, - GTK_ANCHOR_WEST, FALSE); + GTK_ANCHOR_WEST); break; default: diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c index 23a0879cce..bac44b4a53 100644 --- a/app/tools/gimpblendtool.c +++ b/app/tools/gimpblendtool.c @@ -386,8 +386,7 @@ gimp_blend_tool_draw (GimpDrawTool *draw_tool) blend_tool->start_x, blend_tool->start_y, blend_tool->end_x, - blend_tool->end_y, - FALSE); + blend_tool->end_y); /* Draw start target */ gimp_draw_tool_draw_handle (draw_tool, @@ -396,8 +395,7 @@ gimp_blend_tool_draw (GimpDrawTool *draw_tool) blend_tool->start_y, TARGET_SIZE, TARGET_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); /* Draw end target */ gimp_draw_tool_draw_handle (draw_tool, @@ -406,8 +404,7 @@ gimp_blend_tool_draw (GimpDrawTool *draw_tool) blend_tool->end_y, TARGET_SIZE, TARGET_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); } static void diff --git a/app/tools/gimpbrushtool.c b/app/tools/gimpbrushtool.c index e276768c93..dcb85e6002 100644 --- a/app/tools/gimpbrushtool.c +++ b/app/tools/gimpbrushtool.c @@ -345,15 +345,13 @@ gimp_brush_tool_draw_brush (GimpBrushTool *brush_tool, gimp_draw_tool_draw_boundary (draw_tool, brush_core->transformed_brush_bound_segs, brush_core->n_brush_bound_segs, - x, y, - FALSE); + x, y); } else if (draw_fallback) { gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_CROSS, x, y, - 5, 5, GTK_ANCHOR_CENTER, - FALSE); + 5, 5, GTK_ANCHOR_CENTER); } } } diff --git a/app/tools/gimpcolortool.c b/app/tools/gimpcolortool.c index f9f64fbbc4..f462c77879 100644 --- a/app/tools/gimpcolortool.c +++ b/app/tools/gimpcolortool.c @@ -579,13 +579,11 @@ gimp_color_tool_draw (GimpDrawTool *draw_tool) gimp_draw_tool_draw_line (draw_tool, 0, color_tool->sample_point_y + 0.5, gimp_image_get_width (image), - color_tool->sample_point_y + 0.5, - FALSE); + color_tool->sample_point_y + 0.5); gimp_draw_tool_draw_line (draw_tool, color_tool->sample_point_x + 0.5, 0, color_tool->sample_point_x + 0.5, - gimp_image_get_height (image), - FALSE); + gimp_image_get_height (image)); } } else @@ -599,8 +597,7 @@ gimp_color_tool_draw (GimpDrawTool *draw_tool) color_tool->center_x - radius, color_tool->center_y - radius, 2 * radius + 1, - 2 * radius + 1, - FALSE); + 2 * radius + 1); } } } diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c index 4f56b550b5..7d204fe90b 100644 --- a/app/tools/gimpdrawtool.c +++ b/app/tools/gimpdrawtool.c @@ -443,7 +443,6 @@ gimp_draw_tool_in_radius (GimpDrawTool *draw_tool, * @y1: start point Y in image coordinates * @x2: end point X in image coordinates * @y2: end point Y in image coordinates - * @use_offsets: whether to use the image pixel offsets of the tool's display * * This function takes image space coordinates and transforms them to * screen window coordinates, then draws a line between the resulting @@ -454,8 +453,7 @@ gimp_draw_tool_draw_line (GimpDrawTool *draw_tool, gdouble x1, gdouble y1, gdouble x2, - gdouble y2, - gboolean use_offsets) + gdouble y2) { GimpDisplayShell *shell; gdouble tx1, ty1; @@ -479,11 +477,11 @@ gimp_draw_tool_draw_line (GimpDrawTool *draw_tool, gimp_display_shell_transform_xy_f (shell, x1, y1, &tx1, &ty1, - use_offsets); + FALSE); gimp_display_shell_transform_xy_f (shell, x2, y2, &tx2, &ty2, - use_offsets); + FALSE); gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR, PROJ_ROUND (tx1), PROJ_ROUND (ty1), @@ -497,7 +495,6 @@ gimp_draw_tool_draw_line (GimpDrawTool *draw_tool, * @y1: start point Y in image coordinates * @x2: end point X in image coordinates * @y2: end point Y in image coordinates - * @use_offsets: whether to use the image pixel offsets of the tool's display * * This function takes image space coordinates and transforms them to * screen window coordinates, then draws a dashed line between the @@ -508,8 +505,7 @@ gimp_draw_tool_draw_dashed_line (GimpDrawTool *draw_tool, gdouble x1, gdouble y1, gdouble x2, - gdouble y2, - gboolean use_offsets) + gdouble y2) { GimpDisplayShell *shell; gdouble tx1, ty1; @@ -522,11 +518,11 @@ gimp_draw_tool_draw_dashed_line (GimpDrawTool *draw_tool, gimp_display_shell_transform_xy_f (shell, x1, y1, &tx1, &ty1, - use_offsets); + FALSE); gimp_display_shell_transform_xy_f (shell, x2, y2, &tx2, &ty2, - use_offsets); + FALSE); gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR_DASHED, @@ -588,7 +584,6 @@ gimp_draw_tool_draw_guide_line (GimpDrawTool *draw_tool, * @y: vertical image coordinate * @width: width in image coordinates * @height: height in image coordinates - * @use_offsets: whether to use the image pixel offsets of the tool's display * * This function takes image space coordinates and transforms them to * screen window coordinates, then draws the resulting rectangle. @@ -599,8 +594,7 @@ gimp_draw_tool_draw_rectangle (GimpDrawTool *draw_tool, gdouble x, gdouble y, gdouble width, - gdouble height, - gboolean use_offsets) + gdouble height) { GimpDisplayShell *shell; gdouble tx1, ty1; @@ -625,11 +619,11 @@ gimp_draw_tool_draw_rectangle (GimpDrawTool *draw_tool, gimp_display_shell_transform_xy_f (shell, MIN (x, x + width), MIN (y, y + height), &tx1, &ty1, - use_offsets); + FALSE); gimp_display_shell_transform_xy_f (shell, MAX (x, x + width), MAX (y, y + height), &tx2, &ty2, - use_offsets); + FALSE); tx1 = CLAMP (tx1, -1, shell->disp_width + 1); ty1 = CLAMP (ty1, -1, shell->disp_height + 1); @@ -665,8 +659,7 @@ gimp_draw_tool_draw_arc (GimpDrawTool *draw_tool, gdouble width, gdouble height, gint angle1, - gint angle2, - gboolean use_offsets) + gint angle2) { GimpDisplayShell *shell; gdouble tx1, ty1; @@ -680,11 +673,11 @@ gimp_draw_tool_draw_arc (GimpDrawTool *draw_tool, gimp_display_shell_transform_xy_f (shell, MIN (x, x + width), MIN (y, y + height), &tx1, &ty1, - use_offsets); + FALSE); gimp_display_shell_transform_xy_f (shell, MAX (x, x + width), MAX (y, y + height), &tx2, &ty2, - use_offsets); + FALSE); tx2 -= tx1; ty2 -= ty1; @@ -729,8 +722,7 @@ gimp_draw_tool_draw_rectangle_by_anchor (GimpDrawTool *draw_tool, gdouble y, gint width, gint height, - GtkAnchorType anchor, - gboolean use_offsets) + GtkAnchorType anchor) { GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display); gdouble tx, ty; @@ -738,7 +730,7 @@ gimp_draw_tool_draw_rectangle_by_anchor (GimpDrawTool *draw_tool, gimp_display_shell_transform_xy_f (shell, x, y, &tx, &ty, - use_offsets); + FALSE); gimp_draw_tool_shift_to_north_west (tx, ty, width, height, @@ -767,8 +759,7 @@ gimp_draw_tool_draw_arc_by_anchor (GimpDrawTool *draw_tool, gint height, gint angle1, gint angle2, - GtkAnchorType anchor, - gboolean use_offsets) + GtkAnchorType anchor) { GimpDisplayShell *shell; gdouble tx, ty; @@ -780,7 +771,7 @@ gimp_draw_tool_draw_arc_by_anchor (GimpDrawTool *draw_tool, gimp_display_shell_transform_xy_f (shell, x, y, &tx, &ty, - use_offsets); + FALSE); gimp_draw_tool_shift_to_north_west (tx, ty, width, height, @@ -806,8 +797,7 @@ gimp_draw_tool_draw_cross_by_anchor (GimpDrawTool *draw_tool, gdouble y, gint width, gint height, - GtkAnchorType anchor, - gboolean use_offsets) + GtkAnchorType anchor) { GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display); gdouble tx, ty; @@ -815,7 +805,7 @@ gimp_draw_tool_draw_cross_by_anchor (GimpDrawTool *draw_tool, gimp_display_shell_transform_xy_f (shell, x, y, &tx, &ty, - use_offsets); + FALSE); gimp_draw_tool_shift_to_center (tx, ty, width, height, @@ -841,8 +831,7 @@ gimp_draw_tool_draw_handle (GimpDrawTool *draw_tool, gdouble y, gint width, gint height, - GtkAnchorType anchor, - gboolean use_offsets) + GtkAnchorType anchor) { g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool)); @@ -865,8 +854,7 @@ gimp_draw_tool_draw_handle (GimpDrawTool *draw_tool, x, y, width, height, - anchor, - use_offsets); + anchor); break; case GIMP_HANDLE_FILLED_SQUARE: @@ -875,8 +863,7 @@ gimp_draw_tool_draw_handle (GimpDrawTool *draw_tool, x, y, width, height, - anchor, - use_offsets); + anchor); break; case GIMP_HANDLE_CIRCLE: @@ -886,8 +873,7 @@ gimp_draw_tool_draw_handle (GimpDrawTool *draw_tool, width, height, 0, 360 * 64, - anchor, - use_offsets); + anchor); break; case GIMP_HANDLE_FILLED_CIRCLE: @@ -897,8 +883,7 @@ gimp_draw_tool_draw_handle (GimpDrawTool *draw_tool, width, height, 0, 360 * 64, - anchor, - use_offsets); + anchor); break; case GIMP_HANDLE_CROSS: @@ -906,8 +891,7 @@ gimp_draw_tool_draw_handle (GimpDrawTool *draw_tool, x, y, width, height, - anchor, - use_offsets); + anchor); break; default: @@ -928,7 +912,6 @@ gimp_draw_tool_draw_handle (GimpDrawTool *draw_tool, * @width: corner width * @height: corner height * @anchor: which corner to draw - * @use_offsets: whether to use the image pixel offsets of the tool's display * * This function takes image space coordinates and transforms them to * screen window coordinates. It draws a corner into an already drawn @@ -944,8 +927,7 @@ gimp_draw_tool_draw_corner (GimpDrawTool *draw_tool, gdouble y2, gint width, gint height, - GtkAnchorType anchor, - gboolean use_offsets) + GtkAnchorType anchor) { GimpDisplayShell *shell; GimpCanvas *canvas; @@ -960,8 +942,8 @@ gimp_draw_tool_draw_corner (GimpDrawTool *draw_tool, shell = gimp_display_get_shell (draw_tool->display); canvas = GIMP_CANVAS (shell->canvas); - gimp_display_shell_transform_xy (shell, x1, y1, &tx1, &ty1, use_offsets); - gimp_display_shell_transform_xy (shell, x2, y2, &tx2, &ty2, use_offsets); + gimp_display_shell_transform_xy (shell, x1, y1, &tx1, &ty1, FALSE); + gimp_display_shell_transform_xy (shell, x2, y2, &tx2, &ty2, FALSE); tw = tx2 - tx1; th = ty2 - ty1; @@ -1353,8 +1335,7 @@ void gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool, const GimpVector2 *points, gint n_points, - gboolean filled, - gboolean use_offsets) + gboolean filled) { GimpDisplayShell *shell; GdkPoint *coords; @@ -1380,7 +1361,7 @@ gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool, coords = g_new (GdkPoint, n_points); gimp_display_shell_transform_points (shell, - points, coords, n_points, use_offsets); + points, coords, n_points, FALSE); if (filled) { @@ -1402,8 +1383,7 @@ void gimp_draw_tool_draw_strokes (GimpDrawTool *draw_tool, const GimpCoords *points, gint n_points, - gboolean filled, - gboolean use_offsets) + gboolean filled) { GimpDisplayShell *shell; GdkPoint *coords; @@ -1429,7 +1409,7 @@ gimp_draw_tool_draw_strokes (GimpDrawTool *draw_tool, coords = g_new (GdkPoint, n_points); gimp_display_shell_transform_coords (shell, - points, coords, n_points, use_offsets); + points, coords, n_points, FALSE); if (filled) { @@ -1454,7 +1434,6 @@ gimp_draw_tool_draw_strokes (GimpDrawTool *draw_tool, * @n_bound_segs: the number of segments in @bound_segs * @offset_x: x offset * @offset_y: y offset - * @use_offsets: whether to use offsets * * Draw the boundary of the brush that @draw_tool uses. The boundary * should be sorted with sort_boundary(), and @n_bound_segs should @@ -1466,8 +1445,7 @@ gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool, const BoundSeg *bound_segs, gint n_bound_segs, gdouble offset_x, - gdouble offset_y, - gboolean use_offsets) + gdouble offset_y) { GimpDisplayShell *shell; GdkPoint *gdk_points; @@ -1512,7 +1490,7 @@ gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool, bound_segs[i].x1 + offset_x, bound_segs[i].y1 + offset_y, &x, &y, - use_offsets); + FALSE); gdk_points[0].x = PROJ_ROUND (CLAMP (x, -1, xmax)); gdk_points[0].y = PROJ_ROUND (CLAMP (y, -1, ymax)); @@ -1544,7 +1522,7 @@ gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool, bound_segs[i].x2 + offset_x, bound_segs[i].y2 + offset_y, &x, &y, - use_offsets); + FALSE); gdk_points[n_gdk_points].x = PROJ_ROUND (CLAMP (x, -1, xmax)); gdk_points[n_gdk_points].y = PROJ_ROUND (CLAMP (y, -1, ymax)); @@ -1578,8 +1556,7 @@ gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool, void gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool, PangoRectangle *cursor, - gboolean overwrite, - gboolean use_offsets) + gboolean overwrite) { GimpDisplayShell *shell; gdouble tx1, ty1; @@ -1592,7 +1569,7 @@ gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool, gimp_display_shell_transform_xy_f (shell, cursor->x, cursor->y, &tx1, &ty1, - use_offsets); + FALSE); if (overwrite) { @@ -1603,7 +1580,7 @@ gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool, cursor->x + cursor->width, cursor->y + cursor->height, &tx2, &ty2, - use_offsets); + FALSE); x = PROJ_ROUND (tx1); y = PROJ_ROUND (ty1); @@ -1625,7 +1602,7 @@ gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool, cursor->x, cursor->y + cursor->height, &tx2, &ty2, - use_offsets); + FALSE); /* vertical line */ gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), @@ -1669,8 +1646,7 @@ gimp_draw_tool_on_handle (GimpDrawTool *draw_tool, gdouble handle_y, gint width, gint height, - GtkAnchorType anchor, - gboolean use_offsets) + GtkAnchorType anchor) { GimpDisplayShell *shell; gdouble tx, ty; @@ -1684,11 +1660,11 @@ gimp_draw_tool_on_handle (GimpDrawTool *draw_tool, gimp_display_shell_transform_xy_f (shell, x, y, &tx, &ty, - use_offsets); + FALSE); gimp_display_shell_transform_xy_f (shell, handle_x, handle_y, &handle_tx, &handle_ty, - use_offsets); + FALSE); switch (type) { @@ -1797,8 +1773,7 @@ gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool, (*ret_anchor)->position.x, (*ret_anchor)->position.y, width, height, - GTK_ANCHOR_CENTER, - FALSE) && + GTK_ANCHOR_CENTER) && (*ret_anchor)->type == preferred) { if (ret_stroke) *ret_stroke = pref_stroke; @@ -1813,8 +1788,7 @@ gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool, pref_anchor->position.x, pref_anchor->position.y, width, height, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { if (ret_anchor) *ret_anchor = pref_anchor; if (ret_stroke) *ret_stroke = pref_stroke; @@ -1829,8 +1803,7 @@ gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool, anchor->position.x, anchor->position.y, width, height, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { if (ret_anchor) *ret_anchor = anchor; @@ -1909,8 +1882,7 @@ gimp_draw_tool_on_vectors_curve (GimpDrawTool *draw_tool, min_coords.x, min_coords.y, width, height, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { return TRUE; } diff --git a/app/tools/gimpdrawtool.h b/app/tools/gimpdrawtool.h index e01a3171cc..1c32ebba01 100644 --- a/app/tools/gimpdrawtool.h +++ b/app/tools/gimpdrawtool.h @@ -97,14 +97,12 @@ void gimp_draw_tool_draw_line (GimpDrawTool *draw_tool, gdouble x1, gdouble y1, gdouble x2, - gdouble y2, - gboolean use_offsets); + gdouble y2); void gimp_draw_tool_draw_dashed_line (GimpDrawTool *draw_tool, gdouble x1, gdouble y1, gdouble x2, - gdouble y2, - gboolean use_offsets); + gdouble y2); void gimp_draw_tool_draw_guide_line (GimpDrawTool *draw_tool, GimpOrientationType orientation, gint position); @@ -113,8 +111,7 @@ void gimp_draw_tool_draw_rectangle (GimpDrawTool *draw_tool, gdouble x, gdouble y, gdouble width, - gdouble height, - gboolean use_offsets); + gdouble height); void gimp_draw_tool_draw_arc (GimpDrawTool *draw_tool, gboolean filled, gdouble x, @@ -122,8 +119,7 @@ void gimp_draw_tool_draw_arc (GimpDrawTool *draw_tool, gdouble width, gdouble height, gint angle1, - gint angle2, - gboolean use_offsets); + gint angle2); void gimp_draw_tool_draw_arc_by_anchor (GimpDrawTool *draw_tool, gboolean filled, @@ -133,8 +129,7 @@ void gimp_draw_tool_draw_arc_by_anchor (GimpDrawTool *draw_tool, gint height, gint angle1, gint angle2, - GtkAnchorType anchor, - gboolean use_offsets); + GtkAnchorType anchor); void gimp_draw_tool_draw_handle (GimpDrawTool *draw_tool, GimpHandleType type, @@ -142,8 +137,7 @@ void gimp_draw_tool_draw_handle (GimpDrawTool *draw_tool, gdouble y, gint width, gint height, - GtkAnchorType anchor, - gboolean use_offsets); + GtkAnchorType anchor); void gimp_draw_tool_draw_corner (GimpDrawTool *draw_tool, gboolean highlight, gboolean put_outside, @@ -153,31 +147,26 @@ void gimp_draw_tool_draw_corner (GimpDrawTool *draw_tool, gdouble y2, gint width, gint height, - GtkAnchorType anchor, - gboolean use_offsets); + GtkAnchorType anchor); void gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool, const GimpVector2 *points, gint n_points, - gboolean filled, - gboolean use_offsets); + gboolean filled); void gimp_draw_tool_draw_strokes (GimpDrawTool *draw_tool, const GimpCoords *points, gint n_points, - gboolean filled, - gboolean use_offsets); + gboolean filled); void gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool, const BoundSeg *bound_segs, gint n_bound_segs, gdouble offset_x, - gdouble offset_y, - gboolean use_offsets); + gdouble offset_y); void gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool, PangoRectangle *cursor, - gboolean overwrite, - gboolean use_offsets); + gboolean overwrite); gboolean gimp_draw_tool_on_handle (GimpDrawTool *draw_tool, GimpDisplay *display, @@ -188,8 +177,7 @@ gboolean gimp_draw_tool_on_handle (GimpDrawTool *draw_tool, gdouble handle_y, gint width, gint height, - GtkAnchorType anchor, - gboolean use_offsets); + GtkAnchorType anchor); gboolean gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool, GimpDisplay *display, GimpVectors *vectors, diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c index d4f8c20cf6..b75aec5f5d 100644 --- a/app/tools/gimpeditselectiontool.c +++ b/app/tools/gimpeditselectiontool.c @@ -816,8 +816,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool) edit_select->segs_in, edit_select->num_segs_in, edit_select->cumlx + off_x, - edit_select->cumly + off_y, - FALSE); + edit_select->cumly + off_y); } if (edit_select->segs_out) @@ -826,8 +825,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool) edit_select->segs_out, edit_select->num_segs_out, edit_select->cumlx + off_x, - edit_select->cumly + off_y, - FALSE); + edit_select->cumly + off_y); } else if (edit_select->edit_mode != GIMP_TRANSLATE_MODE_MASK) { @@ -836,21 +834,26 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool) edit_select->cumlx + off_x, edit_select->cumly + off_y, gimp_item_get_width (active_item), - gimp_item_get_height (active_item), - FALSE); + gimp_item_get_height (active_item)); } } break; case GIMP_TRANSLATE_MODE_MASK_TO_LAYER: case GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER: - gimp_draw_tool_draw_rectangle (draw_tool, - FALSE, - edit_select->x1, - edit_select->y1, - edit_select->x2 - edit_select->x1, - edit_select->y2 - edit_select->y1, - TRUE); + { + gint off_x; + gint off_y; + + gimp_item_get_offset (active_item, &off_x, &off_y); + + gimp_draw_tool_draw_rectangle (draw_tool, + FALSE, + edit_select->x1 + off_x, + edit_select->y1 + off_y, + edit_select->x2 - edit_select->x1, + edit_select->y2 - edit_select->y1); + } break; case GIMP_TRANSLATE_MODE_LAYER: @@ -900,11 +903,9 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool) g_list_free (linked); } - gimp_draw_tool_draw_rectangle (draw_tool, - FALSE, + gimp_draw_tool_draw_rectangle (draw_tool, FALSE, x1, y1, - x2 - x1, y2 - y1, - FALSE); + x2 - x1, y2 - y1); } break; @@ -954,11 +955,9 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool) x2 = ceil (x2); y2 = ceil (y2); - gimp_draw_tool_draw_rectangle (draw_tool, - FALSE, + gimp_draw_tool_draw_rectangle (draw_tool, FALSE, x1, y1, - x2 - x1, y2 - y1, - FALSE); + x2 - x1, y2 - y1); } break; @@ -967,8 +966,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool) edit_select->segs_in, edit_select->num_segs_in, edit_select->cumlx, - edit_select->cumly, - FALSE); + edit_select->cumly); break; } @@ -979,8 +977,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool) edit_select->center_y + edit_select->cumly, CENTER_CROSS_SIZE, CENTER_CROSS_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool); } diff --git a/app/tools/gimpellipseselecttool.c b/app/tools/gimpellipseselecttool.c index 7c7e9d92f6..9e7b0ccedf 100644 --- a/app/tools/gimpellipseselecttool.c +++ b/app/tools/gimpellipseselecttool.c @@ -114,8 +114,7 @@ gimp_ellipse_select_tool_draw (GimpDrawTool *draw_tool) FALSE, x1, y1, x2 - x1, y2 - y1, - 0, 360 * 64, - FALSE); + 0, 360 * 64); } static void diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c index 196e127b19..f23fa6252f 100644 --- a/app/tools/gimpforegroundselecttool.c +++ b/app/tools/gimpforegroundselecttool.c @@ -607,14 +607,14 @@ gimp_foreground_select_tool_draw (GimpDrawTool *draw_tool) y < y1 + radius || y > y2 - radius) { gimp_draw_tool_draw_rectangle (draw_tool, FALSE, - x1, y1, x2 - x1, y2 - y1, FALSE); + x1, y1, + x2 - x1, y2 - y1); } } gimp_draw_tool_draw_arc (draw_tool, FALSE, x - radius, y - radius, - 2 * radius, 2 * radius, 0, 360 * 64, - FALSE); + 2 * radius, 2 * radius, 0, 360 * 64); } else { diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c index 5d118dab87..53ff8d80e9 100644 --- a/app/tools/gimpfreeselecttool.c +++ b/app/tools/gimpfreeselecttool.c @@ -1545,7 +1545,7 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool) &coords); gimp_draw_tool_draw_lines (draw_tool, priv->points, priv->n_points, - FALSE, FALSE); + FALSE); /* We always show the handle for the first point, even with button1 * down, since releasing the button on the first point will close @@ -1598,7 +1598,7 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool) point->x, point->y, HANDLE_SIZE, HANDLE_SIZE, - GTK_ANCHOR_CENTER, FALSE); + GTK_ANCHOR_CENTER); } } @@ -1610,8 +1610,7 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool) last.x, last.y, priv->pending_point.x, - priv->pending_point.y, - FALSE); + priv->pending_point.y); } } diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c index fc7af58a03..3b598323e4 100644 --- a/app/tools/gimpiscissorstool.c +++ b/app/tools/gimpiscissorstool.c @@ -610,8 +610,7 @@ gimp_iscissors_tool_button_release (GimpTool *tool, GIMP_HANDLE_CIRCLE, curve->x1, curve->y1, POINT_WIDTH, POINT_WIDTH, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { iscissors->x = curve->x1; iscissors->y = curve->y1; @@ -756,16 +755,14 @@ gimp_iscissors_tool_draw (GimpDrawTool *draw_tool) GIMP_HANDLE_CROSS, iscissors->x, iscissors->y, TARGET_SIZE, TARGET_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); /* Draw a line boundary */ if (! iscissors->first_point && ! (iscissors->draw & DRAW_LIVEWIRE)) { gimp_draw_tool_draw_line (draw_tool, iscissors->ix, iscissors->iy, - iscissors->x, iscissors->y, - FALSE); + iscissors->x, iscissors->y); } } @@ -819,8 +816,7 @@ gimp_iscissors_tool_draw (GimpDrawTool *draw_tool) iscissors->iy, POINT_WIDTH, POINT_WIDTH, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); } /* Go through the list of icurves, and render each one... */ @@ -843,8 +839,7 @@ gimp_iscissors_tool_draw (GimpDrawTool *draw_tool) curve->y1, POINT_WIDTH, POINT_WIDTH, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); if (iscissors->draw & DRAW_ACTIVE_CURVE) { @@ -867,8 +862,7 @@ gimp_iscissors_tool_draw (GimpDrawTool *draw_tool) iscissors->curve1->x2, iscissors->curve1->y2, iscissors->nx, - iscissors->ny, - FALSE); + iscissors->ny); } if (iscissors->curve2) { @@ -876,8 +870,7 @@ gimp_iscissors_tool_draw (GimpDrawTool *draw_tool) iscissors->curve2->x1, iscissors->curve2->y1, iscissors->nx, - iscissors->ny, - FALSE); + iscissors->ny); } gimp_draw_tool_draw_handle (draw_tool, @@ -886,8 +879,7 @@ gimp_iscissors_tool_draw (GimpDrawTool *draw_tool) iscissors->ny, POINT_WIDTH, POINT_WIDTH, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); } } @@ -915,7 +907,7 @@ iscissors_draw_curve (GimpDrawTool *draw_tool, points[i].y = (coords >> 16); } - gimp_draw_tool_draw_lines (draw_tool, points, len, FALSE, FALSE); + gimp_draw_tool_draw_lines (draw_tool, points, len, FALSE); g_free (points); } @@ -953,8 +945,7 @@ gimp_iscissors_tool_oper_update (GimpTool *tool, GIMP_HANDLE_CIRCLE, curve->x1, curve->y1, POINT_WIDTH, POINT_WIDTH, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { gimp_tool_replace_status (tool, display, _("Click to close the" " curve")); @@ -1225,8 +1216,7 @@ mouse_over_vertex (GimpIscissorsTool *iscissors, GIMP_HANDLE_CIRCLE, curve->x1, curve->y1, POINT_WIDTH, POINT_WIDTH, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { iscissors->curve1 = curve; @@ -1239,8 +1229,7 @@ mouse_over_vertex (GimpIscissorsTool *iscissors, GIMP_HANDLE_CIRCLE, curve->x2, curve->y2, POINT_WIDTH, POINT_WIDTH, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { iscissors->curve2 = curve; diff --git a/app/tools/gimpmagnifytool.c b/app/tools/gimpmagnifytool.c index 9881a67326..353cd58c29 100644 --- a/app/tools/gimpmagnifytool.c +++ b/app/tools/gimpmagnifytool.c @@ -364,11 +364,9 @@ gimp_magnify_tool_draw (GimpDrawTool *draw_tool) { GimpMagnifyTool *magnify = GIMP_MAGNIFY_TOOL (draw_tool); - gimp_draw_tool_draw_rectangle (draw_tool, - FALSE, + gimp_draw_tool_draw_rectangle (draw_tool, FALSE, magnify->x, magnify->y, magnify->w, - magnify->h, - FALSE); + magnify->h); } diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c index e6b73c6a79..d874126a97 100644 --- a/app/tools/gimpmeasuretool.c +++ b/app/tools/gimpmeasuretool.c @@ -218,8 +218,7 @@ gimp_measure_tool_button_press (GimpTool *tool, measure->x[i], measure->y[i], TARGET * 2, TARGET * 2, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { if (state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) { @@ -555,8 +554,7 @@ gimp_measure_tool_cursor_update (GimpTool *tool, measure->x[i], measure->y[i], TARGET * 2, TARGET * 2, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { in_handle = TRUE; @@ -678,8 +676,7 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool) measure->y[i], TARGET, TARGET, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); } else { @@ -689,8 +686,7 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool) measure->y[i], TARGET * 2, TARGET * 2, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); } if (i > 0) @@ -699,8 +695,7 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool) measure->x[0], measure->y[0], measure->x[i], - measure->y[i], - FALSE); + measure->y[i]); /* only draw the arc if the lines are long enough */ if (gimp_draw_tool_calc_distance (draw_tool, tool->display, @@ -733,8 +728,7 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool) ARC_RADIUS * 2, ARC_RADIUS * 2, angle1, angle2, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); if (measure->num_points == 2) { @@ -753,8 +747,7 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool) (measure->x[1] >= measure->x[0] ? measure->x[0] + arc_radius + target : measure->x[0] - arc_radius - target), - measure->y[0], - FALSE); + measure->y[0]); } } } diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c index 6ef21df86f..b67d4792b9 100644 --- a/app/tools/gimppainttool.c +++ b/app/tools/gimppainttool.c @@ -708,38 +708,41 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool) if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (draw_tool))) { GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (draw_tool); - GimpPaintCore *core = paint_tool->core; if (paint_tool->draw_line && ! gimp_tool_control_is_active (GIMP_TOOL (draw_tool)->control)) { + GimpPaintCore *core = paint_tool->core; + GimpImage *image = gimp_display_get_image (draw_tool->display); + GimpDrawable *drawable = gimp_image_get_active_drawable (image); + gint off_x, off_y; + + gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y); + /* Draw start target */ gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_CROSS, - core->last_coords.x, - core->last_coords.y, + core->last_coords.x + off_x, + core->last_coords.y + off_y, HANDLE_SIZE, HANDLE_SIZE, - GTK_ANCHOR_CENTER, - TRUE); + GTK_ANCHOR_CENTER); /* Draw end target */ gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_CROSS, - core->cur_coords.x, - core->cur_coords.y, + core->cur_coords.x + off_x, + core->cur_coords.y + off_y, HANDLE_SIZE, HANDLE_SIZE, - GTK_ANCHOR_CENTER, - TRUE); + GTK_ANCHOR_CENTER); /* Draw the line between the start and end coords */ gimp_draw_tool_draw_line (draw_tool, - core->last_coords.x, - core->last_coords.y, - core->cur_coords.x, - core->cur_coords.y, - TRUE); + core->last_coords.x + off_x, + core->last_coords.y + off_y, + core->cur_coords.x + off_x, + core->cur_coords.y + off_y); } } diff --git a/app/tools/gimpperspectiveclonetool.c b/app/tools/gimpperspectiveclonetool.c index 502f068849..bddc436bf6 100644 --- a/app/tools/gimpperspectiveclonetool.c +++ b/app/tools/gimpperspectiveclonetool.c @@ -749,46 +749,38 @@ gimp_perspective_clone_tool_draw (GimpDrawTool *draw_tool) /* draw the bounding box */ gimp_draw_tool_draw_line (draw_tool, clone_tool->tx1, clone_tool->ty1, - clone_tool->tx2, clone_tool->ty2, - FALSE); + clone_tool->tx2, clone_tool->ty2); gimp_draw_tool_draw_line (draw_tool, clone_tool->tx2, clone_tool->ty2, - clone_tool->tx4, clone_tool->ty4, - FALSE); + clone_tool->tx4, clone_tool->ty4); gimp_draw_tool_draw_line (draw_tool, clone_tool->tx3, clone_tool->ty3, - clone_tool->tx4, clone_tool->ty4, - FALSE); + clone_tool->tx4, clone_tool->ty4); gimp_draw_tool_draw_line (draw_tool, clone_tool->tx3, clone_tool->ty3, - clone_tool->tx1, clone_tool->ty1, - FALSE); + clone_tool->tx1, clone_tool->ty1); /* draw the tool handles */ gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_SQUARE, clone_tool->tx1, clone_tool->ty1, HANDLE_SIZE, HANDLE_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_SQUARE, clone_tool->tx2, clone_tool->ty2, HANDLE_SIZE, HANDLE_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_SQUARE, clone_tool->tx3, clone_tool->ty3, HANDLE_SIZE, HANDLE_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_SQUARE, clone_tool->tx4, clone_tool->ty4, HANDLE_SIZE, HANDLE_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); } if (GIMP_CLONE_OPTIONS (options)->clone_type == GIMP_IMAGE_CLONE && @@ -804,8 +796,7 @@ gimp_perspective_clone_tool_draw (GimpDrawTool *draw_tool) clone_tool->src_x, clone_tool->src_y, TARGET_SIZE, TARGET_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); draw_tool->display = tmp_display; } diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c index e2be2d5553..07868ff791 100644 --- a/app/tools/gimprectangleselecttool.c +++ b/app/tools/gimprectangleselecttool.c @@ -315,26 +315,22 @@ gimp_rectangle_select_tool_draw (GimpDrawTool *draw_tool) gimp_draw_tool_draw_arc (draw_tool, FALSE, x1, y1, square_size, square_size, - 90 * 64, 90 * 64, - FALSE); + 90 * 64, 90 * 64); gimp_draw_tool_draw_arc (draw_tool, FALSE, x2 - square_size, y1, square_size, square_size, - 0, 90 * 64, - FALSE); + 0, 90 * 64); gimp_draw_tool_draw_arc (draw_tool, FALSE, x2 - square_size, y2 - square_size, square_size, square_size, - 270 * 64, 90 * 64, - FALSE); + 270 * 64, 90 * 64); gimp_draw_tool_draw_arc (draw_tool, FALSE, x1, y2 - square_size, square_size, square_size, - 180 * 64, 90 * 64, - FALSE); + 180 * 64, 90 * 64); } } diff --git a/app/tools/gimprectangletool.c b/app/tools/gimprectangletool.c index 3cf2d39822..370af8cb87 100644 --- a/app/tools/gimprectangletool.c +++ b/app/tools/gimprectangletool.c @@ -1738,8 +1738,7 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw_tool) pub_x1, pub_y1, pub_x2 - pub_x1, - pub_y2 - pub_y1, - FALSE); + pub_y2 - pub_y1); switch (private->function) { @@ -1754,8 +1753,7 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw_tool) (pub_y1 + pub_y2) / 2.0, CENTER_CROSS_SIZE, CENTER_CROSS_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); break; } else @@ -1770,25 +1768,25 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw_tool) pub_x2, pub_y2, private->corner_handle_w, private->corner_handle_h, - GTK_ANCHOR_NORTH_WEST, FALSE); + GTK_ANCHOR_NORTH_WEST); gimp_draw_tool_draw_corner (draw_tool, FALSE, private->narrow_mode, pub_x1, pub_y1, pub_x2, pub_y2, private->corner_handle_w, private->corner_handle_h, - GTK_ANCHOR_NORTH_EAST, FALSE); + GTK_ANCHOR_NORTH_EAST); gimp_draw_tool_draw_corner (draw_tool, FALSE, private->narrow_mode, pub_x1, pub_y1, pub_x2, pub_y2, private->corner_handle_w, private->corner_handle_h, - GTK_ANCHOR_SOUTH_WEST, FALSE); + GTK_ANCHOR_SOUTH_WEST); gimp_draw_tool_draw_corner (draw_tool, FALSE, private->narrow_mode, pub_x1, pub_y1, pub_x2, pub_y2, private->corner_handle_w, private->corner_handle_h, - GTK_ANCHOR_SOUTH_EAST, FALSE); + GTK_ANCHOR_SOUTH_EAST); break; case GIMP_RECTANGLE_TOOL_RESIZING_TOP: @@ -1800,8 +1798,7 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw_tool) pub_x2, pub_y2, private->top_and_bottom_handle_w, private->corner_handle_h, - gimp_rectangle_tool_get_anchor (private), - FALSE); + gimp_rectangle_tool_get_anchor (private)); break; case GIMP_RECTANGLE_TOOL_RESIZING_LEFT: @@ -1813,8 +1810,7 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw_tool) pub_x2, pub_y2, private->corner_handle_w, private->left_and_right_handle_h, - gimp_rectangle_tool_get_anchor (private), - FALSE); + gimp_rectangle_tool_get_anchor (private)); break; default: @@ -1825,8 +1821,7 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw_tool) pub_x2, pub_y2, private->corner_handle_w, private->corner_handle_h, - gimp_rectangle_tool_get_anchor (private), - FALSE); + gimp_rectangle_tool_get_anchor (private)); break; } @@ -1851,52 +1846,52 @@ gimp_rectangle_tool_draw_guides (GimpDrawTool *draw_tool) case GIMP_RECTANGLE_GUIDE_CENTER_LINES: gimp_draw_tool_draw_line (draw_tool, x1, (y1 + y2) / 2, - x2, (y1 + y2) / 2, FALSE); + x2, (y1 + y2) / 2); gimp_draw_tool_draw_line (draw_tool, (x1 + x2) / 2, y1, - (x1 + x2) / 2, y2, FALSE); + (x1 + x2) / 2, y2); break; case GIMP_RECTANGLE_GUIDE_THIRDS: gimp_draw_tool_draw_line (draw_tool, x1, (2 * y1 + y2) / 3, - x2, (2 * y1 + y2) / 3, FALSE); + x2, (2 * y1 + y2) / 3); gimp_draw_tool_draw_line (draw_tool, x1, (y1 + 2 * y2) / 3, - x2, (y1 + 2 * y2) / 3, FALSE); + x2, (y1 + 2 * y2) / 3); gimp_draw_tool_draw_line (draw_tool, (2 * x1 + x2) / 3, y1, - (2 * x1 + x2) / 3, y2, FALSE); + (2 * x1 + x2) / 3, y2); gimp_draw_tool_draw_line (draw_tool, (x1 + 2 * x2) / 3, y1, - (x1 + 2 * x2) / 3, y2, FALSE); + (x1 + 2 * x2) / 3, y2); break; case GIMP_RECTANGLE_GUIDE_FIFTHS: gimp_draw_tool_draw_line (draw_tool, x1, y1 + (y2 - y1) / 5, - x2, y1 + (y2 - y1) / 5, FALSE); + x2, y1 + (y2 - y1) / 5); gimp_draw_tool_draw_line (draw_tool, x1, y1 + 2 * (y2 - y1) / 5, - x2, y1 + 2 * (y2 - y1) / 5, FALSE); + x2, y1 + 2 * (y2 - y1) / 5); gimp_draw_tool_draw_line (draw_tool, x1, y1 + 3 * (y2 - y1) / 5, - x2, y1 + 3 * (y2 - y1) / 5, FALSE); + x2, y1 + 3 * (y2 - y1) / 5); gimp_draw_tool_draw_line (draw_tool, x1, y1 + 4 * (y2 - y1) / 5, - x2, y1 + 4 * (y2 - y1) / 5, FALSE); + x2, y1 + 4 * (y2 - y1) / 5); gimp_draw_tool_draw_line (draw_tool, x1 + (x2 - x1) / 5, y1, - x1 + (x2 - x1) / 5, y2, FALSE); + x1 + (x2 - x1) / 5, y2); gimp_draw_tool_draw_line (draw_tool, x1 + 2 * (x2 - x1) / 5, y1, - x1 + 2 * (x2 - x1) / 5, y2, FALSE); + x1 + 2 * (x2 - x1) / 5, y2); gimp_draw_tool_draw_line (draw_tool, x1 + 3 * (x2 - x1) / 5, y1, - x1 + 3 * (x2 - x1) / 5, y2, FALSE); + x1 + 3 * (x2 - x1) / 5, y2); gimp_draw_tool_draw_line (draw_tool, x1 + 4 * (x2 - x1) / 5, y1, - x1 + 4 * (x2 - x1) / 5, y2, FALSE); + x1 + 4 * (x2 - x1) / 5, y2); break; case GIMP_RECTANGLE_GUIDE_GOLDEN: @@ -1904,25 +1899,22 @@ gimp_rectangle_tool_draw_guides (GimpDrawTool *draw_tool) x1, (2 * y1 + (1 + SQRT5) * y2) / (3 + SQRT5), x2, - (2 * y1 + (1 + SQRT5) * y2) / (3 + SQRT5), - FALSE); + (2 * y1 + (1 + SQRT5) * y2) / (3 + SQRT5)); gimp_draw_tool_draw_line (draw_tool, x1, ((1 + SQRT5) * y1 + 2 * y2) / (3 + SQRT5), x2, - ((1 + SQRT5) * y1 + 2 * y2) / (3 + SQRT5), - FALSE); + ((1 + SQRT5) * y1 + 2 * y2) / (3 + SQRT5)); gimp_draw_tool_draw_line (draw_tool, (2 * x1 + (1 + SQRT5) * x2) / (3 + SQRT5), y1, (2 * x1 + (1 + SQRT5) * x2) / (3 + SQRT5), - y2, - FALSE); + y2); gimp_draw_tool_draw_line (draw_tool, ((1 + SQRT5) * x1 + 2 * x2) / (3 + SQRT5), y1, ((1 + SQRT5) * x1 + 2 * x2) / (3 + SQRT5), - y2, FALSE); + y2); break; /* This code implements the method of diagonals discovered by @@ -1938,13 +1930,12 @@ gimp_rectangle_tool_draw_guides (GimpDrawTool *draw_tool) /* diagonal from the top-left edge */ gimp_draw_tool_draw_line (draw_tool, x1, y1, - x1 + square_side, y1 + square_side, - FALSE); + x1 + square_side, y1 + square_side); + /* diagonal from the top-right edge */ gimp_draw_tool_draw_line (draw_tool, x2, y1, - x2 - square_side, y1 + square_side, - FALSE); + x2 - square_side, y1 + square_side); /* If user selected a square, we cannot draw from bottom points * as we would erase the guides drawn from the top points @@ -1954,13 +1945,12 @@ gimp_rectangle_tool_draw_guides (GimpDrawTool *draw_tool) /* diagonal from the bottom-left edge */ gimp_draw_tool_draw_line (draw_tool, x1, y2, - x1 + square_side, y2 - square_side, - FALSE); + x1 + square_side, y2 - square_side); + /* diagonal from the bottom-right edge */ gimp_draw_tool_draw_line (draw_tool, x2, y2, - x2 - square_side, y2 - square_side, - FALSE); + x2 - square_side, y2 - square_side); } } break; @@ -2858,8 +2848,7 @@ gimp_rectangle_tool_coord_on_handle (GimpRectangleTool *rect_tool, GIMP_HANDLE_SQUARE, handle_x, handle_y, handle_width, handle_height, - anchor, - FALSE); + anchor); } static GtkAnchorType diff --git a/app/tools/gimpsourcetool.c b/app/tools/gimpsourcetool.c index 83e86cfb7d..26d5b3bda2 100644 --- a/app/tools/gimpsourcetool.c +++ b/app/tools/gimpsourcetool.c @@ -387,8 +387,7 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool) source_tool->src_x + off_x, source_tool->src_y + off_y, TARGET_SIZE, TARGET_SIZE, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); draw_tool->display = tmp_display; } diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c index d6c336d31b..c8d4feeca3 100644 --- a/app/tools/gimptexttool.c +++ b/app/tools/gimptexttool.c @@ -802,15 +802,18 @@ gimp_text_tool_draw (GimpDrawTool *draw_tool) /* If the text buffer has no selection, draw the text cursor */ PangoRectangle cursor_rect; + gint off_x, off_y; gboolean overwrite; gimp_text_tool_editor_get_cursor_rect (text_tool, &cursor_rect); + gimp_item_get_offset (GIMP_ITEM (text_tool->layer), &off_x, &off_y); + cursor_rect.x += off_x; + cursor_rect.y += off_y; + overwrite = text_tool->overwrite_mode && cursor_rect.width > 0; - gimp_draw_tool_draw_text_cursor (draw_tool, - &cursor_rect, overwrite, - TRUE); + gimp_draw_tool_draw_text_cursor (draw_tool, &cursor_rect, overwrite); } } @@ -822,6 +825,7 @@ gimp_text_tool_draw_selection (GimpDrawTool *draw_tool) PangoLayout *layout; gint offset_x; gint offset_y; + gint off_x, off_y; PangoLayoutIter *iter; GtkTextIter sel_start, sel_end; gint min, max; @@ -836,6 +840,10 @@ gimp_text_tool_draw_selection (GimpDrawTool *draw_tool) gimp_text_layout_get_offsets (text_tool->layout, &offset_x, &offset_y); + gimp_item_get_offset (GIMP_ITEM (text_tool->layer), &off_x, &off_y); + offset_x += off_x; + offset_y += off_y; + iter = pango_layout_get_iter (layout); do @@ -865,8 +873,7 @@ gimp_text_tool_draw_selection (GimpDrawTool *draw_tool) gimp_draw_tool_draw_rectangle (draw_tool, TRUE, rect.x, rect.y, - rect.width, rect.height, - TRUE); + rect.width, rect.height); } } while (pango_layout_iter_next_char (iter)); diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index fc020d8e3f..76de6785b5 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -629,8 +629,7 @@ gimp_transform_tool_oper_update (GimpTool *tool, GIMP_HANDLE_SQUARE, x, y, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { tr_tool->function = TRANSFORM_HANDLE_N; } @@ -643,8 +642,7 @@ gimp_transform_tool_oper_update (GimpTool *tool, GIMP_HANDLE_SQUARE, x, y, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { tr_tool->function = TRANSFORM_HANDLE_E; } @@ -657,8 +655,7 @@ gimp_transform_tool_oper_update (GimpTool *tool, GIMP_HANDLE_SQUARE, x, y, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { tr_tool->function = TRANSFORM_HANDLE_S; } @@ -671,8 +668,7 @@ gimp_transform_tool_oper_update (GimpTool *tool, GIMP_HANDLE_SQUARE, x, y, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { tr_tool->function = TRANSFORM_HANDLE_W; } @@ -686,8 +682,7 @@ gimp_transform_tool_oper_update (GimpTool *tool, tr_tool->tcx, tr_tool->tcy, MIN (tr_tool->handle_w, tr_tool->handle_h), MIN (tr_tool->handle_w, tr_tool->handle_h), - GTK_ANCHOR_CENTER, - FALSE)) + GTK_ANCHOR_CENTER)) { tr_tool->function = TRANSFORM_HANDLE_CENTER; } @@ -792,20 +787,16 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) /* draw the bounding box */ gimp_draw_tool_draw_line (draw_tool, tr_tool->tx1, tr_tool->ty1, - tr_tool->tx2, tr_tool->ty2, - FALSE); + tr_tool->tx2, tr_tool->ty2); gimp_draw_tool_draw_line (draw_tool, tr_tool->tx2, tr_tool->ty2, - tr_tool->tx4, tr_tool->ty4, - FALSE); + tr_tool->tx4, tr_tool->ty4); gimp_draw_tool_draw_line (draw_tool, tr_tool->tx3, tr_tool->ty3, - tr_tool->tx4, tr_tool->ty4, - FALSE); + tr_tool->tx4, tr_tool->ty4); gimp_draw_tool_draw_line (draw_tool, tr_tool->tx3, tr_tool->ty3, - tr_tool->tx1, tr_tool->ty1, - FALSE); + tr_tool->tx1, tr_tool->ty1); /* We test if the transformed polygon is convex. * if z1 and z2 have the same sign as well as z3 and z4 @@ -836,8 +827,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) tr_tool->tgrid_coords[gci], tr_tool->tgrid_coords[gci + 1], tr_tool->tgrid_coords[gci + 2], - tr_tool->tgrid_coords[gci + 3], - FALSE); + tr_tool->tgrid_coords[gci + 3]); } } } @@ -851,26 +841,22 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) GIMP_HANDLE_SQUARE, tr_tool->tx1, tr_tool->ty1, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_SQUARE, tr_tool->tx2, tr_tool->ty2, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_SQUARE, tr_tool->tx3, tr_tool->ty3, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_SQUARE, tr_tool->tx4, tr_tool->ty4, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); if (tr_tool->use_mid_handles) { @@ -883,8 +869,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) GIMP_HANDLE_SQUARE, x, y, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); x = (tr_tool->tx2 + tr_tool->tx4) / 2.0; y = (tr_tool->ty2 + tr_tool->ty4) / 2.0; @@ -893,8 +878,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) GIMP_HANDLE_SQUARE, x, y, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); x = (tr_tool->tx3 + tr_tool->tx4) / 2.0; y = (tr_tool->ty3 + tr_tool->ty4) / 2.0; @@ -903,8 +887,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) GIMP_HANDLE_SQUARE, x, y, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); x = (tr_tool->tx3 + tr_tool->tx1) / 2.0; y = (tr_tool->ty3 + tr_tool->ty1) / 2.0; @@ -913,8 +896,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) GIMP_HANDLE_SQUARE, x, y, tr_tool->handle_w, tr_tool->handle_h, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); } } @@ -927,14 +909,12 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) GIMP_HANDLE_CIRCLE, tr_tool->tcx, tr_tool->tcy, d, d, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_CROSS, tr_tool->tcx, tr_tool->tcy, d, d, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); } if (tr_tool->type == GIMP_TRANSFORM_TYPE_SELECTION) @@ -987,8 +967,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) gimp_draw_tool_draw_boundary (draw_tool, segs_in, num_segs_in, - 0, 0, - FALSE); + 0, 0); g_free (segs_in); } @@ -1019,8 +998,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) gimp_draw_tool_draw_boundary (draw_tool, segs_out, num_segs_out, - 0, 0, - FALSE); + 0, 0); g_free (segs_out); } } @@ -1060,7 +1038,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool) gimp_draw_tool_draw_strokes (draw_tool, &g_array_index (coords, GimpCoords, 0), - coords->len, FALSE, FALSE); + coords->len, FALSE); } if (coords) diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c index 5a57a68186..55e5bd7978 100644 --- a/app/tools/gimpvectortool.c +++ b/app/tools/gimpvectortool.c @@ -1432,8 +1432,7 @@ gimp_vector_tool_draw (GimpDrawTool *draw_tool) cur_anchor->position.y, TARGET, TARGET, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); } } @@ -1454,8 +1453,7 @@ gimp_vector_tool_draw (GimpDrawTool *draw_tool) cur_anchor->position.y, TARGET - 3, TARGET - 3, - GTK_ANCHOR_CENTER, - FALSE); + GTK_ANCHOR_CENTER); } g_list_free (draw_anchors); @@ -1471,12 +1469,12 @@ gimp_vector_tool_draw (GimpDrawTool *draw_tool) for (i = 0; i < coords->len; i += 2) { - gimp_draw_tool_draw_dashed_line (draw_tool, - g_array_index (coords, GimpCoords, i).x, - g_array_index (coords, GimpCoords, i).y, - g_array_index (coords, GimpCoords, i + 1).x, - g_array_index (coords, GimpCoords, i + 1).y, - FALSE); + gimp_draw_tool_draw_dashed_line + (draw_tool, + g_array_index (coords, GimpCoords, i).x, + g_array_index (coords, GimpCoords, i).y, + g_array_index (coords, GimpCoords, i + 1).x, + g_array_index (coords, GimpCoords, i + 1).y); } } @@ -1495,7 +1493,7 @@ gimp_vector_tool_draw (GimpDrawTool *draw_tool) gimp_draw_tool_draw_strokes (draw_tool, &g_array_index (coords, GimpCoords, 0), - coords->len, FALSE, FALSE); + coords->len, FALSE); g_array_free (coords, TRUE); } @@ -1541,7 +1539,7 @@ gimp_vector_tool_vectors_visible (GimpVectors *vectors, gimp_draw_tool_draw_strokes (draw_tool, &g_array_index (coords, GimpCoords, 0), - coords->len, FALSE, FALSE); + coords->len, FALSE); g_array_free (coords, TRUE); }