app: gimp_brush_core_clamp_brush_scale() -> gimp_brush_clamp_scale()

This commit is contained in:
Michael Natterer 2011-01-17 23:20:01 +01:00
parent 403edb853f
commit eb04265ce3
3 changed files with 18 additions and 15 deletions

View File

@ -517,6 +517,18 @@ gimp_brush_transform_pixmap (GimpBrush *brush,
return GIMP_BRUSH_GET_CLASS (brush)->transform_pixmap (brush, scale, aspect_ratio, angle, hardness);
}
gdouble
gimp_brush_clamp_scale (GimpBrush *brush,
gdouble scale)
{
g_return_val_if_fail (GIMP_IS_BRUSH (brush), 1.0);
/* ensure that the final brush mask remains >= 0.5 pixel along both axes */
return MAX (0.5 / (gfloat) MIN (brush->mask->width,
brush->mask->height),
scale);
}
TempBuf *
gimp_brush_get_mask (const GimpBrush *brush)
{

View File

@ -109,6 +109,9 @@ TempBuf * gimp_brush_transform_pixmap (GimpBrush *brush,
gdouble angle,
gdouble hardness);
gdouble gimp_brush_clamp_scale (GimpBrush *brush,
gdouble scale);
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);

View File

@ -110,8 +110,6 @@ 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_transform_mask (GimpBrushCore *core,
GimpBrush *brush);
static TempBuf * gimp_brush_core_transform_pixmap (GimpBrushCore *core,
@ -839,7 +837,7 @@ gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
coords);
}
core->scale = gimp_brush_core_clamp_brush_scale (core, core->scale);
core->scale = gimp_brush_clamp_scale (core->main_brush, core->scale);
gimp_brush_transform_size (core->brush,
core->scale, core->aspect_ratio, core->angle,
@ -957,7 +955,7 @@ gimp_brush_core_create_boundary (GimpBrushCore *core,
if (scale > 0.0)
{
scale = gimp_brush_core_clamp_brush_scale (core, scale);
scale = gimp_brush_clamp_scale (core->main_brush, scale);
/* Generated brushes are a bit special */
if (GIMP_IS_BRUSH_GENERATED (core->main_brush))
@ -1071,7 +1069,7 @@ gimp_brush_core_get_transform (GimpBrushCore *core,
if ((scale > 0.0) && (aspect_ratio > 0.0))
{
scale = gimp_brush_core_clamp_brush_scale (core, scale);
scale = gimp_brush_clamp_scale (core->main_brush, scale);
gimp_brush_transform_matrix (height, width,
scale, aspect_ratio, angle, matrix);
@ -1533,16 +1531,6 @@ 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_transform_mask (GimpBrushCore *core,
GimpBrush *brush)