138
139
g_assert (GIMP_IS_BRUSH_CORE (paint_tool->core));
140
brush_tool->show_cursor =
141
GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config)->show_paint_tool_cursor;
142
brush_tool->draw_brush =
143
GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config)->show_brush_outline;
145
g_signal_connect_object (tool->tool_info->gimp->config,
146
"notify::show-paint-tool-cursor",
141
display_config = GIMP_DISPLAY_CONFIG (tool->tool_info->gimp->config);
143
brush_tool->show_cursor = display_config->show_paint_tool_cursor;
144
brush_tool->draw_brush = display_config->show_brush_outline;
146
g_signal_connect_object (display_config, "notify::show-paint-tool-cursor",
147
147
G_CALLBACK (gimp_brush_tool_notify_brush),
149
g_signal_connect_object (tool->tool_info->gimp->config,
150
"notify::show-brush-outline",
149
g_signal_connect_object (display_config, "notify::show-brush-outline",
151
150
G_CALLBACK (gimp_brush_tool_notify_brush),
259
258
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (draw_tool)))
262
if (brush_tool->draw_brush)
264
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (draw_tool);
265
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (draw_tool);
266
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
268
/* don't create the segments for the purpose of undrawing (if we
269
* don't have the segments, we can hardly have drawn them before)
271
if (! brush_core->brush_bound_segs && brush_core->main_brush &&
272
! gimp_draw_tool_is_drawn (draw_tool))
274
gimp_brush_core_create_bound_segs (brush_core, paint_options);
277
if (brush_core->brush_bound_segs)
279
gdouble brush_x, brush_y;
281
brush_x = (brush_tool->brush_x -
282
((gdouble) brush_core->brush_bound_width / 2.0));
283
brush_y = (brush_tool->brush_y -
284
((gdouble) brush_core->brush_bound_height / 2.0));
286
if (gimp_paint_options_get_brush_mode (paint_options) ==
261
gimp_brush_tool_draw_brush (brush_tool,
262
brush_tool->brush_x, brush_tool->brush_y);
266
gimp_brush_tool_draw_brush (GimpBrushTool *brush_tool,
270
GimpDrawTool *draw_tool;
271
GimpBrushCore *brush_core;
272
GimpPaintOptions *paint_options;
274
g_return_if_fail (GIMP_IS_BRUSH_TOOL (brush_tool));
276
if (! brush_tool->draw_brush)
279
draw_tool = GIMP_DRAW_TOOL (brush_tool);
280
brush_core = GIMP_BRUSH_CORE (GIMP_PAINT_TOOL (brush_tool)->core);
281
paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (brush_tool);
283
/* don't create the segments for the purpose of undrawing (if we
284
* don't have the segments, we can hardly have drawn them before)
286
if (! brush_core->brush_bound_segs && brush_core->main_brush &&
287
! gimp_draw_tool_is_drawn (draw_tool))
289
gimp_brush_core_create_bound_segs (brush_core, paint_options);
292
if (brush_core->brush_bound_segs)
294
x -= ((gdouble) brush_core->brush_bound_width / 2.0);
295
y -= ((gdouble) brush_core->brush_bound_height / 2.0);
297
if (gimp_paint_options_get_brush_mode (paint_options) == GIMP_BRUSH_HARD)
289
299
#define EPSILON 0.000001
291
/* Add EPSILON before rounding since e.g.
292
* (5.0 - 0.5) may end up at (4.499999999....)
293
* due to floating point fnords
295
brush_x = RINT (brush_x + EPSILON);
296
brush_y = RINT (brush_y + EPSILON);
301
/* Add EPSILON before rounding since e.g.
302
* (5.0 - 0.5) may end up at (4.499999999....)
303
* due to floating point fnords
305
x = RINT (x + EPSILON);
306
y = RINT (y + EPSILON);
301
gimp_draw_tool_draw_boundary (draw_tool,
302
brush_core->brush_bound_segs,
303
brush_core->n_brush_bound_segs,
311
gimp_draw_tool_draw_boundary (draw_tool,
312
brush_core->brush_bound_segs,
313
brush_core->n_brush_bound_segs,