[gimp] app: gimp_brush_core_clamp_brush_scale() -> gimp_brush_clamp_scale()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: gimp_brush_core_clamp_brush_scale() -> gimp_brush_clamp_scale()
- Date: Mon, 17 Jan 2011 22:21:36 +0000 (UTC)
commit eb04265ce3d14759b9114a0bee87fbb527d74b34
Author: Michael Natterer <mitch gimp org>
Date: Mon Jan 17 23:20:01 2011 +0100
app: gimp_brush_core_clamp_brush_scale() -> gimp_brush_clamp_scale()
app/core/gimpbrush.c | 12 ++++++++++++
app/core/gimpbrush.h | 3 +++
app/paint/gimpbrushcore.c | 18 +++---------------
3 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/app/core/gimpbrush.c b/app/core/gimpbrush.c
index 1d12558..5cae9b6 100644
--- a/app/core/gimpbrush.c
+++ b/app/core/gimpbrush.c
@@ -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)
{
diff --git a/app/core/gimpbrush.h b/app/core/gimpbrush.h
index 0beeb4e..ad20d78 100644
--- a/app/core/gimpbrush.h
+++ b/app/core/gimpbrush.h
@@ -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);
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index cc0c3de..50aa11b 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]