Commit eb04265c authored by Michael Natterer's avatar Michael Natterer 😴

app: gimp_brush_core_clamp_brush_scale() -> gimp_brush_clamp_scale()

parent 403edb85
......@@ -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)
{
......
......@@ -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);
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment