diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c index 9b4e405268..e9ee01e96c 100644 --- a/app/tools/gimpdrawtool.c +++ b/app/tools/gimpdrawtool.c @@ -1463,13 +1463,10 @@ gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool, } void -gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool, - gdouble x1, - gdouble y1, - gdouble x2, - gdouble y2, - gboolean overwrite, - gboolean use_offsets) +gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool, + PangoRectangle *cursor, + gboolean overwrite, + gboolean use_offsets) { GimpDisplayShell *shell; gdouble tx1, ty1; @@ -1480,31 +1477,43 @@ gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool, shell = gimp_display_get_shell (draw_tool->display); gimp_display_shell_transform_xy_f (shell, - x1, y1, + cursor->x, cursor->y, &tx1, &ty1, use_offsets); - gimp_display_shell_transform_xy_f (shell, - x2, y2, - &tx2, &ty2, - use_offsets); if (overwrite) { + gint x, y; + gint width, height; + + gimp_display_shell_transform_xy_f (shell, + cursor->x + cursor->width, + cursor->y + cursor->height, + &tx2, &ty2, + use_offsets); + + x = PROJ_ROUND (tx1); + y = PROJ_ROUND (ty1); + width = PROJ_ROUND (tx2 - tx1); + height = PROJ_ROUND (ty2 - ty1); + gimp_canvas_draw_rectangle (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR, FALSE, - PROJ_ROUND (tx1), - PROJ_ROUND (ty1), - PROJ_ROUND (tx2 - tx1), - PROJ_ROUND (ty2 - ty1)); + x, y, + width, height); gimp_canvas_draw_rectangle (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR, FALSE, - PROJ_ROUND (tx1) + 1, - PROJ_ROUND (ty1) + 1, - PROJ_ROUND (tx2 - tx1) - 2, - PROJ_ROUND (ty2 - ty1) - 2); + x + 1, y + 1, + width - 2, height - 2); } else { + gimp_display_shell_transform_xy_f (shell, + cursor->x, + cursor->y + cursor->height, + &tx2, &ty2, + use_offsets); + /* vertical line */ gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR, diff --git a/app/tools/gimpdrawtool.h b/app/tools/gimpdrawtool.h index 508a99c300..738caf6362 100644 --- a/app/tools/gimpdrawtool.h +++ b/app/tools/gimpdrawtool.h @@ -203,10 +203,7 @@ void gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool, gboolean use_offsets); void gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool, - gdouble x1, - gdouble y1, - gdouble x2, - gdouble y2, + PangoRectangle *cursor, gboolean overwrite, gboolean use_offsets); diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c index 16258cfa93..94b3666370 100644 --- a/app/tools/gimptexttool.c +++ b/app/tools/gimptexttool.c @@ -773,13 +773,7 @@ gimp_text_tool_draw (GimpDrawTool *draw_tool) overwrite = text_tool->overwrite_mode && cursor_rect.width > 0; gimp_draw_tool_draw_text_cursor (draw_tool, - cursor_rect.x, - cursor_rect.y, - overwrite ? - cursor_rect.x + cursor_rect.width : - cursor_rect.x, - cursor_rect.y + cursor_rect.height, - overwrite, + &cursor_rect, overwrite, TRUE); } }