Index: app/paint/gimpbrushcore.c =================================================================== RCS file: /cvs/gnome/gimp/app/paint/gimpbrushcore.c,v retrieving revision 1.29 diff -u -p -r1.29 gimpbrushcore.c --- app/paint/gimpbrushcore.c 9 Nov 2006 14:54:48 -0000 1.29 +++ app/paint/gimpbrushcore.c 15 Nov 2006 19:28:59 -0000 @@ -24,6 +24,7 @@ #include "paint-types.h" +#include "base/boundary.h" #include "base/pixel-region.h" #include "base/temp-buf.h" @@ -653,12 +654,17 @@ gimp_brush_core_get_paint_area (GimpPain { GimpPressureOptions *pressure_options = paint_options->pressure_options; - if (pressure_options->inverse_size) - core->scale = 1.0 - 0.9 * paint_core->cur_coords.pressure; - else if (pressure_options->size) - core->scale = paint_core->cur_coords.pressure; - else - core->scale = 1.0; + core->scale = 1.0; + + if (paint_core->use_pressure) + { + if (pressure_options->inverse_size) + core->scale = 1.0 - 0.9 * paint_core->cur_coords.pressure; + else if (pressure_options->size) + core->scale = paint_core->cur_coords.pressure; + } + + core->scale *= paint_options->brush_scale; } gimp_brush_core_calc_brush_size (core, core->brush->mask, core->scale, @@ -731,6 +737,57 @@ gimp_brush_core_set_brush (GimpBrushCore } void +gimp_brush_core_create_bound_segs (GimpBrushCore *core, + GimpPaintOptions *paint_options) +{ + TempBuf *mask = NULL; + gdouble scale = 1.0; + gint brush_width; + gint brush_height; + + g_return_if_fail (GIMP_IS_BRUSH_CORE (core)); + g_return_if_fail (core->main_brush != NULL); + g_return_if_fail (core->brush_bound_segs == NULL); + + if (GIMP_BRUSH_CORE_GET_CLASS (core)->use_scale) + scale *= paint_options->brush_scale; + + scale = gimp_brush_core_calc_brush_size (core, core->main_brush->mask, scale, + &brush_width, &brush_height); + + if (scale > 0.0) + mask = gimp_brush_scale_mask (core->main_brush, scale); + + if (mask) + { + PixelRegion PR = { 0, }; + BoundSeg *boundary; + gint num_groups; + + pixel_region_init_temp_buf (&PR, mask, + 0, 0, mask->width, mask->height); + + boundary = boundary_find (&PR, BOUNDARY_WITHIN_BOUNDS, + 0, 0, PR.w, PR.h, + 0, + &core->n_brush_bound_segs); + + core->brush_bound_segs = boundary_sort (boundary, + core->n_brush_bound_segs, + &num_groups); + + core->n_brush_bound_segs += num_groups; + + g_free (boundary); + + core->brush_bound_width = mask->width; + core->brush_bound_height = mask->height; + + temp_buf_free (mask); + } +} + +void gimp_brush_core_paste_canvas (GimpBrushCore *core, GimpDrawable *drawable, gdouble brush_opacity, @@ -841,10 +898,12 @@ gimp_brush_core_calc_brush_size (GimpBru { gdouble ratio = 1.0; - scale = CLAMP (scale, 0.0, 1.0); + scale = CLAMP (scale, 0.0, 5.0); - if (! GIMP_PAINT_CORE (core)->use_pressure) + if (scale == 1.0) { + ratio = scale; + *width = mask->width; *height = mask->height; } @@ -1199,7 +1258,7 @@ gimp_brush_core_scale_mask (GimpBrushCor gint dest_width; gint dest_height; - scale = CLAMP (scale, 0.0, 1.0); + scale = CLAMP (scale, 0.0, 5.0); if (scale == 0.0) return NULL; @@ -1242,7 +1301,7 @@ gimp_brush_core_scale_pixmap (GimpBrushC gint dest_width; gint dest_height; - scale = CLAMP (scale, 0.0, 1.0); + scale = CLAMP (scale, 0.0, 5.0); if (scale == 0.0) return NULL; @@ -1284,10 +1343,7 @@ gimp_brush_core_get_brush_mask (GimpBrus GimpPaintCore *paint_core = GIMP_PAINT_CORE (core); MaskBuf *mask; - if (paint_core->use_pressure) - mask = gimp_brush_core_scale_mask (core, core->brush, scale); - else - mask = core->brush->mask; + mask = gimp_brush_core_scale_mask (core, core->brush, scale); if (! mask) return NULL; Index: app/paint/gimpbrushcore.h =================================================================== RCS file: /cvs/gnome/gimp/app/paint/gimpbrushcore.h,v retrieving revision 1.9 diff -u -p -r1.9 gimpbrushcore.h --- app/paint/gimpbrushcore.h 12 Apr 2006 12:49:22 -0000 1.9 +++ app/paint/gimpbrushcore.h 15 Nov 2006 19:28:59 -0000 @@ -98,6 +98,9 @@ GType gimp_brush_core_get_type ( void gimp_brush_core_set_brush (GimpBrushCore *core, GimpBrush *brush); +void gimp_brush_core_create_bound_segs (GimpBrushCore *core, + GimpPaintOptions *options); + void gimp_brush_core_paste_canvas (GimpBrushCore *core, GimpDrawable *drawable, gdouble brush_opacity, Index: app/paint/gimppaintoptions.c =================================================================== RCS file: /cvs/gnome/gimp/app/paint/gimppaintoptions.c,v retrieving revision 1.34 diff -u -p -r1.34 gimppaintoptions.c --- app/paint/gimppaintoptions.c 29 Aug 2006 21:43:22 -0000 1.34 +++ app/paint/gimppaintoptions.c 15 Nov 2006 19:29:00 -0000 @@ -33,6 +33,7 @@ #include "gimppaintoptions.h" +#define DEFAULT_BRUSH_SCALE 1.0 #define DEFAULT_APPLICATION_MODE GIMP_PAINT_CONSTANT #define DEFAULT_HARD FALSE @@ -62,6 +63,7 @@ enum { PROP_0, PROP_PAINT_INFO, + PROP_BRUSH_SCALE, PROP_APPLICATION_MODE, PROP_HARD, PROP_PRESSURE_EXPANDED, @@ -127,6 +129,10 @@ gimp_paint_options_class_init (GimpPaint GIMP_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRUSH_SCALE, + "brush-scale", NULL, + 0.0, 5.0, DEFAULT_BRUSH_SCALE, + GIMP_PARAM_STATIC_STRINGS); GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_APPLICATION_MODE, "application-mode", NULL, GIMP_TYPE_PAINT_APPLICATION_MODE, @@ -297,6 +303,9 @@ gimp_paint_options_set_property (GObject options->paint_info = (GimpPaintInfo *) g_value_dup_object (value); break; + case PROP_BRUSH_SCALE: + options->brush_scale = g_value_get_double (value); + break; case PROP_APPLICATION_MODE: options->application_mode = g_value_get_enum (value); break; @@ -409,6 +418,9 @@ gimp_paint_options_get_property (GObject g_value_set_object (value, options->paint_info); break; + case PROP_BRUSH_SCALE: + g_value_set_double (value, options->brush_scale); + break; case PROP_APPLICATION_MODE: g_value_set_enum (value, options->application_mode); break; Index: app/paint/gimppaintoptions.h =================================================================== RCS file: /cvs/gnome/gimp/app/paint/gimppaintoptions.h,v retrieving revision 1.23 diff -u -p -r1.23 gimppaintoptions.h --- app/paint/gimppaintoptions.h 28 Mar 2006 17:08:30 -0000 1.23 +++ app/paint/gimppaintoptions.h 15 Nov 2006 19:29:00 -0000 @@ -85,6 +85,8 @@ struct _GimpPaintOptions GimpPaintInfo *paint_info; + gdouble brush_scale; + GimpPaintApplicationMode application_mode; GimpPaintApplicationMode application_mode_save; Index: app/tools/gimpbrushtool.c =================================================================== RCS file: /cvs/gnome/gimp/app/tools/gimpbrushtool.c,v retrieving revision 1.150 diff -u -p -r1.150 gimpbrushtool.c --- app/tools/gimpbrushtool.c 13 Sep 2006 11:04:49 -0000 1.150 +++ app/tools/gimpbrushtool.c 15 Nov 2006 19:29:00 -0000 @@ -24,10 +24,6 @@ #include "config/gimpdisplayconfig.h" -#include "base/boundary.h" -#include "base/pixel-region.h" -#include "base/temp-buf.h" - #include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpimage.h" @@ -66,6 +62,9 @@ static void gimp_brush_tool_draw static void gimp_brush_tool_brush_changed (GimpContext *context, GimpBrush *brush, GimpBrushTool *brush_tool); +static void gimp_brush_tool_brush_scaled (GimpPaintOptions *options, + GParamSpec *pspec, + GimpBrushTool *brush_tool); static void gimp_brush_tool_set_brush (GimpBrushCore *brush_core, GimpBrush *brush, GimpBrushTool *brush_tool); @@ -153,6 +152,9 @@ gimp_brush_tool_constructor (GType g_signal_connect_object (gimp_tool_get_options (tool), "brush-changed", G_CALLBACK (gimp_brush_tool_brush_changed), brush_tool, 0); + g_signal_connect_object (gimp_tool_get_options (tool), "notify::brush-scale", + G_CALLBACK (gimp_brush_tool_brush_scaled), + brush_tool, 0); g_signal_connect (paint_tool->core, "set-brush", G_CALLBACK (gimp_brush_tool_set_brush), @@ -263,29 +265,7 @@ gimp_brush_tool_draw (GimpDrawTool *draw if (! brush_core->brush_bound_segs && brush_core->main_brush) { - TempBuf *mask = gimp_brush_get_mask (brush_core->main_brush); - PixelRegion PR = { 0, }; - BoundSeg *boundary; - gint num_groups; - - pixel_region_init_temp_buf (&PR, mask, - 0, 0, mask->width, mask->height); - - boundary = boundary_find (&PR, BOUNDARY_WITHIN_BOUNDS, - 0, 0, PR.w, PR.h, - 0, - &brush_core->n_brush_bound_segs); - - brush_core->brush_bound_segs = - boundary_sort (boundary, brush_core->n_brush_bound_segs, - &num_groups); - - brush_core->n_brush_bound_segs += num_groups; - - g_free (boundary); - - brush_core->brush_bound_width = mask->width; - brush_core->brush_bound_height = mask->height; + gimp_brush_core_create_bound_segs (brush_core, paint_options); } if (brush_core->brush_bound_segs) @@ -332,6 +312,17 @@ gimp_brush_tool_brush_changed (GimpConte if (brush_core->main_brush != brush) gimp_brush_core_set_brush (brush_core, brush); +} + +static void +gimp_brush_tool_brush_scaled (GimpPaintOptions *options, + GParamSpec *pspec, + GimpBrushTool *brush_tool) +{ + GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (brush_tool); + GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core); + + gimp_brush_core_set_brush (brush_core, brush_core->main_brush); } static void Index: app/tools/gimppaintoptions-gui.c =================================================================== RCS file: /cvs/gnome/gimp/app/tools/gimppaintoptions-gui.c,v retrieving revision 1.118 diff -u -p -r1.118 gimppaintoptions-gui.c --- app/tools/gimppaintoptions-gui.c 21 Oct 2006 18:46:38 -0000 1.118 +++ app/tools/gimppaintoptions-gui.c 15 Nov 2006 19:29:00 -0000 @@ -128,6 +128,12 @@ gimp_paint_options_gui (GimpToolOptions gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++, _("Brush:"), 0.0, 0.5, button, 2, FALSE); + + gimp_prop_scale_entry_new (config, "brush-scale", + GTK_TABLE (table), 0, table_row++, + _("Scale:"), + 0.01, 0.1, 2, + FALSE, 0.0, 0.0); } /* the gradient */