mirror of https://github.com/GNOME/gimp.git
Fix bug #491272 (no cursor drawn for small brush sizes):
2007-10-29 Sven Neumann <sven@gimp.org> Fix bug #491272 (no cursor drawn for small brush sizes): * app/tools/gimpbrushtool.[ch] (gimp_brush_tool_draw_brush): don't draw the brush outline if it becomes too small. Instead draw a small cross, but only if "draw_fallback" was passed as TRUE. (gimp_brush_tool_draw_brush): pass TRUE for "draw_fallback" if cursor drawing is disabled for the paint tools. * app/tools/gimpsourcetool.c (gimp_source_tool_draw): pass FALSE for "draw_fallback". * app/tools/gimpdrawtool.c (gimp_draw_tool_draw_cross_by_anchor): draw a symmetric cross for odd handle sizes. svn path=/trunk/; revision=23984
This commit is contained in:
parent
3057677e59
commit
96a46d0d70
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2007-10-29 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Fix bug #491272 (no cursor drawn for small brush sizes):
|
||||
|
||||
* app/tools/gimpbrushtool.[ch]
|
||||
(gimp_brush_tool_draw_brush): don't draw the brush outline if it
|
||||
becomes too small. Instead draw a small cross, but only if
|
||||
"draw_fallback" was passed as TRUE.
|
||||
(gimp_brush_tool_draw_brush): pass TRUE for "draw_fallback" if
|
||||
cursor drawing is disabled for the paint tools.
|
||||
|
||||
* app/tools/gimpsourcetool.c (gimp_source_tool_draw): pass FALSE
|
||||
for "draw_fallback".
|
||||
|
||||
* app/tools/gimpdrawtool.c (gimp_draw_tool_draw_cross_by_anchor):
|
||||
draw a symmetric cross for odd handle sizes.
|
||||
|
||||
2007-10-29 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/tools/gimprectangletool.c (gimp_rectangle_tool_coord_on_handle):
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "paint/gimppaintoptions.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
||||
#include "gimpbrushtool.h"
|
||||
#include "gimptoolcontrol.h"
|
||||
|
@ -259,26 +260,28 @@ gimp_brush_tool_draw (GimpDrawTool *draw_tool)
|
|||
return;
|
||||
|
||||
gimp_brush_tool_draw_brush (brush_tool,
|
||||
brush_tool->brush_x, brush_tool->brush_y);
|
||||
brush_tool->brush_x, brush_tool->brush_y,
|
||||
! brush_tool->show_cursor);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_tool_draw_brush (GimpBrushTool *brush_tool,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
gdouble y,
|
||||
gboolean draw_fallback)
|
||||
{
|
||||
GimpDrawTool *draw_tool;
|
||||
GimpBrushCore *brush_core;
|
||||
GimpPaintOptions *paint_options;
|
||||
GimpPaintOptions *options;
|
||||
|
||||
g_return_if_fail (GIMP_IS_BRUSH_TOOL (brush_tool));
|
||||
|
||||
if (! brush_tool->draw_brush)
|
||||
return;
|
||||
|
||||
draw_tool = GIMP_DRAW_TOOL (brush_tool);
|
||||
brush_core = GIMP_BRUSH_CORE (GIMP_PAINT_TOOL (brush_tool)->core);
|
||||
paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (brush_tool);
|
||||
draw_tool = GIMP_DRAW_TOOL (brush_tool);
|
||||
brush_core = GIMP_BRUSH_CORE (GIMP_PAINT_TOOL (brush_tool)->core);
|
||||
options = GIMP_PAINT_TOOL_GET_OPTIONS (brush_tool);
|
||||
|
||||
/* don't create the segments for the purpose of undrawing (if we
|
||||
* don't have the segments, we can hardly have drawn them before)
|
||||
|
@ -286,33 +289,46 @@ gimp_brush_tool_draw_brush (GimpBrushTool *brush_tool,
|
|||
if (! brush_core->brush_bound_segs && brush_core->main_brush &&
|
||||
! gimp_draw_tool_is_drawn (draw_tool))
|
||||
{
|
||||
gimp_brush_core_create_bound_segs (brush_core, paint_options);
|
||||
gimp_brush_core_create_bound_segs (brush_core, options);
|
||||
}
|
||||
|
||||
if (brush_core->brush_bound_segs)
|
||||
{
|
||||
x -= ((gdouble) brush_core->brush_bound_width / 2.0);
|
||||
y -= ((gdouble) brush_core->brush_bound_height / 2.0);
|
||||
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (draw_tool->display->shell);
|
||||
gdouble width = (gdouble) brush_core->brush_bound_width;
|
||||
gdouble height = (gdouble) brush_core->brush_bound_height;
|
||||
|
||||
if (gimp_paint_options_get_brush_mode (paint_options) == GIMP_BRUSH_HARD)
|
||||
/* don't draw the boundary if it becomes too small */
|
||||
if (SCALEX (shell, width) > 4 && SCALEY (shell, height) > 4)
|
||||
{
|
||||
x -= width / 2.0;
|
||||
y -= height / 2.0;
|
||||
|
||||
if (gimp_paint_options_get_brush_mode (options) == GIMP_BRUSH_HARD)
|
||||
{
|
||||
#define EPSILON 0.000001
|
||||
|
||||
/* Add EPSILON before rounding since e.g.
|
||||
* (5.0 - 0.5) may end up at (4.499999999....)
|
||||
* due to floating point fnords
|
||||
*/
|
||||
x = RINT (x + EPSILON);
|
||||
y = RINT (y + EPSILON);
|
||||
|
||||
/* Add EPSILON before rounding since e.g.
|
||||
* (5.0 - 0.5) may end up at (4.499999999....)
|
||||
* due to floating point fnords
|
||||
*/
|
||||
x = RINT (x + EPSILON);
|
||||
y = RINT (y + EPSILON);
|
||||
#undef EPSILON
|
||||
}
|
||||
}
|
||||
|
||||
gimp_draw_tool_draw_boundary (draw_tool,
|
||||
brush_core->brush_bound_segs,
|
||||
brush_core->n_brush_bound_segs,
|
||||
x, y,
|
||||
FALSE);
|
||||
gimp_draw_tool_draw_boundary (draw_tool,
|
||||
brush_core->brush_bound_segs,
|
||||
brush_core->n_brush_bound_segs,
|
||||
x, y,
|
||||
FALSE);
|
||||
}
|
||||
else if (draw_fallback)
|
||||
{
|
||||
gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_CROSS,
|
||||
x, y,
|
||||
5, 5, GTK_ANCHOR_CENTER,
|
||||
FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ GType gimp_brush_tool_get_type (void) G_GNUC_CONST;
|
|||
|
||||
void gimp_brush_tool_draw_brush (GimpBrushTool *brush_tool,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
gdouble y,
|
||||
gboolean draw_fallback);
|
||||
|
||||
|
||||
#endif /* __GIMP_BRUSH_TOOL_H__ */
|
||||
|
|
|
@ -581,9 +581,9 @@ gimp_draw_tool_draw_rectangle (GimpDrawTool *draw_tool,
|
|||
&tx2, &ty2,
|
||||
use_offsets);
|
||||
|
||||
tx1 = CLAMP (tx1, -1, shell->disp_width + 1);
|
||||
tx1 = CLAMP (tx1, -1, shell->disp_width + 1);
|
||||
ty1 = CLAMP (ty1, -1, shell->disp_height + 1);
|
||||
tx2 = CLAMP (tx2, -1, shell->disp_width + 1);
|
||||
tx2 = CLAMP (tx2, -1, shell->disp_width + 1);
|
||||
ty2 = CLAMP (ty2, -1, shell->disp_height + 1);
|
||||
|
||||
tx2 -= tx1;
|
||||
|
@ -766,11 +766,15 @@ gimp_draw_tool_draw_cross_by_anchor (GimpDrawTool *draw_tool,
|
|||
&tx, &ty);
|
||||
|
||||
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR,
|
||||
PROJ_ROUND (tx), PROJ_ROUND (ty) - (height >> 1),
|
||||
PROJ_ROUND (tx), PROJ_ROUND (ty) + (height >> 1));
|
||||
PROJ_ROUND (tx),
|
||||
PROJ_ROUND (ty) - (height >> 1),
|
||||
PROJ_ROUND (tx),
|
||||
PROJ_ROUND (ty) + ((height + 1) >> 1));
|
||||
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR,
|
||||
PROJ_ROUND (tx) - (width >> 1), PROJ_ROUND (ty),
|
||||
PROJ_ROUND (tx) + (width >> 1), PROJ_ROUND (ty));
|
||||
PROJ_ROUND (tx) - (width >> 1),
|
||||
PROJ_ROUND (ty),
|
||||
PROJ_ROUND (tx) + ((width + 1) >> 1),
|
||||
PROJ_ROUND (ty));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -379,7 +379,8 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool)
|
|||
if (source_tool->show_source_outline)
|
||||
gimp_brush_tool_draw_brush (GIMP_BRUSH_TOOL (source_tool),
|
||||
source_tool->src_x + off_x,
|
||||
source_tool->src_y + off_y);
|
||||
source_tool->src_y + off_y,
|
||||
FALSE);
|
||||
|
||||
gimp_draw_tool_draw_handle (draw_tool,
|
||||
GIMP_HANDLE_CROSS,
|
||||
|
|
Loading…
Reference in New Issue