based on a patch from David Gowers clamp the brush scale so that the brush

2008-09-08  Sven Neumann  <sven@gimp.org>

	* app/paint/gimpbrushcore.c: based on a patch from David Gowers
	clamp the brush scale so that the brush never becomes smaller 
than
	0.5 pixels. Fixes bug #548631.


svn path=/trunk/; revision=26900
This commit is contained in:
Sven Neumann
2008-09-08 19:06:32 +00:00
committed by Sven Neumann
parent 3827523fe7
commit bdce2966d6
2 changed files with 82 additions and 62 deletions

View File

@ -1,3 +1,9 @@
2008-09-08 Sven Neumann <sven@gimp.org>
* app/paint/gimpbrushcore.c: based on a patch from David Gowers
clamp the brush scale so that the brush never becomes smaller than
0.5 pixels. Fixes bug #548631.
2008-09-08 Michael Natterer <mitch@gimp.org>
Bug 551306 Color picker for text tool does not show selected

View File

@ -46,7 +46,6 @@
#define EPSILON 0.00001
enum
{
SET_BRUSH,
@ -100,6 +99,8 @@ static TempBuf * gimp_brush_core_solidify_mask (GimpBrushCore *core,
TempBuf *brush_mask,
gdouble x,
gdouble y);
static gdouble gimp_brush_core_clamp_brush_scale (GimpBrushCore *core,
gdouble scale);
static TempBuf * gimp_brush_core_scale_mask (GimpBrushCore *core,
GimpBrush *brush);
static TempBuf * gimp_brush_core_scale_pixmap (GimpBrushCore *core,
@ -691,10 +692,9 @@ gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
&paint_core->cur_coords,
TRUE);
/* else use scale from start(), we don't support on-the-fly scaling */
core->scale = gimp_brush_core_clamp_brush_scale (core, core->scale);
gimp_brush_scale_size (core->brush, core->scale,
&brush_width, &brush_height);
gimp_brush_scale_size (core->brush, core->scale, &brush_width, &brush_height);
/* adjust the x and y coordinates to the upper left corner of the brush */
x = (gint) floor (paint_core->cur_coords.x) - (brush_width / 2);
@ -782,7 +782,11 @@ gimp_brush_core_create_bound_segs (GimpBrushCore *core,
scale = paint_options->brush_scale;
if (scale > 0.0)
{
scale = gimp_brush_core_clamp_brush_scale (core, scale);
mask = gimp_brush_scale_mask (core->main_brush, scale);
}
if (mask)
{
@ -1263,6 +1267,16 @@ gimp_brush_core_solidify_mask (GimpBrushCore *core,
return dest;
}
static gdouble
gimp_brush_core_clamp_brush_scale (GimpBrushCore *core,
gdouble scale)
{
TempBuf *mask = core->main_brush->mask;
/* ensure that the final brush mask remains >= 0.5 pixel along both axes */
return MAX (0.5 / (gfloat) MIN (mask->width, mask->height), scale);
}
static TempBuf *
gimp_brush_core_scale_mask (GimpBrushCore *core,
GimpBrush *brush)
@ -1271,7 +1285,7 @@ gimp_brush_core_scale_mask (GimpBrushCore *core,
gint height;
if (core->scale <= 0.0)
return NULL;
return NULL; /* Should never happen now, with scale clamping. */
if (core->scale == 1.0)
return brush->mask;