[gimp] app: some cleanup in the new paint options code
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: some cleanup in the new paint options code
- Date: Mon, 17 Nov 2014 21:09:33 +0000 (UTC)
commit c9e75b1fa0d4b64fb3633d18611a14ee3ca266a0
Author: Michael Natterer <mitch gimp org>
Date: Mon Nov 17 19:59:34 2014 +0100
app: some cleanup in the new paint options code
app/core/core-types.h | 2 +-
app/core/gimpcoords-interpolate.c | 4 +---
app/paint/gimpbrushcore.c | 13 +++++++------
app/paint/gimppaintoptions.c | 13 +++++--------
app/paint/gimpsmudge.c | 4 +++-
app/tools/gimppaintoptions-gui.c | 19 +++++++++----------
6 files changed, 26 insertions(+), 29 deletions(-)
---
diff --git a/app/core/core-types.h b/app/core/core-types.h
index 6feac3d..e78583b 100644
--- a/app/core/core-types.h
+++ b/app/core/core-types.h
@@ -254,7 +254,7 @@ struct _GimpCoords
gdouble wheel;
gdouble velocity;
gdouble direction;
- gdouble xscale; /*some tools my care about the shell they passed through*/
+ gdouble xscale; /* the view scale */
gdouble yscale;
};
diff --git a/app/core/gimpcoords-interpolate.c b/app/core/gimpcoords-interpolate.c
index 54ca0af..1cf5115 100644
--- a/app/core/gimpcoords-interpolate.c
+++ b/app/core/gimpcoords-interpolate.c
@@ -322,9 +322,8 @@ gimp_coords_interpolate_catmull (const GimpCoords catmul_pt1,
coords.direction = start_coords.direction + dir_step * n;
coords.direction = coords.direction - floor (coords.direction);
-
- coords.xscale = end_coords.xscale;
+ coords.xscale = end_coords.xscale;
coords.yscale = end_coords.yscale;
g_array_append_val (*ret_coords, coords);
@@ -341,7 +340,6 @@ gimp_coords_get_catmull_spline_point (const gdouble t,
const gdouble p2,
const gdouble p3)
{
-
return ((((-t + 2.0) * t - 1.0) * t / 2.0) * p0 +
((((3.0 * t - 5.0) * t) * t + 2.0) / 2.0) * p1 +
(((-3.0 * t + 4.0) * t + 1.0) * t / 2.0) * p2 +
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index f0b2645..def6239 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -745,8 +745,8 @@ gimp_brush_core_interpolate (GimpPaintCore *paint_core,
current_coords.wheel = last_coords.wheel + p * delta_wheel;
current_coords.velocity = last_coords.velocity + p * delta_velocity;
current_coords.direction = temp_direction;
- current_coords.xscale = last_coords.xscale;
- current_coords.yscale = last_coords.yscale;
+ current_coords.xscale = last_coords.xscale;
+ current_coords.yscale = last_coords.yscale;
if (core->jitter > 0.0)
{
@@ -1510,11 +1510,12 @@ gimp_brush_core_eval_transform_dynamics (GimpBrushCore *core,
if (paint_options->brush_zoom && MAX (coords->xscale, coords->yscale) > 0)
{
core->scale /= MAX (coords->xscale, coords->yscale);
- /*Cap transform result for brushes or OOM can occur*/
- if ((core->scale * max_side) > GIMP_BRUSH_MAX_SIZE)
- {
+
+ /* Cap transform result for brushes or OOM can occur */
+ if ((core->scale * max_side) > GIMP_BRUSH_MAX_SIZE)
+ {
core->scale = GIMP_BRUSH_MAX_SIZE / max_side;
- }
+ }
}
}
else
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index 428f150..77a085a 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -27,7 +27,6 @@
#include "paint-types.h"
#include "core/gimp.h"
-#include "core/gimpbrush.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpimage.h"
#include "core/gimpdynamics.h"
@@ -47,7 +46,7 @@
#define DEFAULT_BRUSH_ANGLE 0.0
#define DEFAULT_BRUSH_SPACING 10.0
-#define DEFAULT_BRUSH_HARDNESS 100.0 /*Generated brushes have their own*/
+#define DEFAULT_BRUSH_HARDNESS 100.0 /* Generated brushes have their own */
#define DEFAULT_BRUSH_FORCE 50.0
#define DEFAULT_APPLICATION_MODE GIMP_PAINT_CONSTANT
@@ -169,11 +168,10 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_BRUSH_ZOOM,
- "brush-zoom", _("Link brush with zoom"),
+ "brush-zoom", _("Link brush size with canvas zoom"),
DEFAULT_BRUSH_ZOOM,
GIMP_PARAM_STATIC_STRINGS);
-
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRUSH_ASPECT_RATIO,
"brush-aspect-ratio", _("Brush Aspect Ratio"),
-20.0, 20.0, DEFAULT_BRUSH_ASPECT_RATIO,
@@ -852,9 +850,9 @@ gimp_paint_options_set_default_brush_hardness (GimpPaintOptions *paint_options,
if (! brush)
brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
- if (GIMP_IS_BRUSH_GENERATED(brush))
+ if (GIMP_IS_BRUSH_GENERATED (brush))
{
- GimpBrushGenerated *generated_brush = GIMP_BRUSH_GENERATED(brush);
+ GimpBrushGenerated *generated_brush = GIMP_BRUSH_GENERATED (brush);
g_object_set (paint_options,
"brush-hardness", (gdouble) gimp_brush_generated_get_hardness (generated_brush) * 100.0,
@@ -868,18 +866,17 @@ gimp_paint_options_set_default_brush_hardness (GimpPaintOptions *paint_options,
}
}
-
void
gimp_paint_options_copy_brush_props (GimpPaintOptions *src,
GimpPaintOptions *dest)
{
gdouble brush_size;
+ gboolean brush_zoom;
gdouble brush_angle;
gdouble brush_aspect_ratio;
gdouble brush_spacing;
gdouble brush_hardness;
gdouble brush_force;
- gboolean brush_zoom;
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (src));
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (dest));
diff --git a/app/paint/gimpsmudge.c b/app/paint/gimpsmudge.c
index 4bdfe66..418b892 100644
--- a/app/paint/gimpsmudge.c
+++ b/app/paint/gimpsmudge.c
@@ -353,7 +353,9 @@ gimp_smudge_accumulator_size (GimpPaintOptions *paint_options,
if (paint_options->brush_zoom)
max_view_scale = MAX (coords->xscale, coords->yscale);
- max_brush_size = MIN (paint_options->brush_size / max_view_scale, GIMP_BRUSH_MAX_SIZE);
+
+ max_brush_size = MIN (paint_options->brush_size / max_view_scale,
+ GIMP_BRUSH_MAX_SIZE);
/* Note: the max brush mask size plus a border of 1 pixel and a
* little headroom
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index fcf09c4..68aeffc 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -181,21 +181,19 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
-/*Brush hardness spinner*/
hbox = gimp_paint_options_gui_scale_with_reset_button
- (config, "brush-hardness", _("Hardness"),
- _("Reset hardness to default"),
- 0.1, 1.0, 0.0, 100.0, 1.0,
- G_CALLBACK (gimp_paint_options_gui_reset_hardness));
+ (config, "brush-hardness", _("Hardness"),
+ _("Reset hardness to default"),
+ 0.1, 1.0, 0.0, 100.0, 1.0,
+ G_CALLBACK (gimp_paint_options_gui_reset_hardness));
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
-/*Brush hardness spinner*/
hbox = gimp_paint_options_gui_scale_with_reset_button
- (config, "brush-force", _("Force"),
- _("Reset force to default"),
- 0.1, 1.0, 0.0, 100.0, 1.0,
- G_CALLBACK (gimp_paint_options_gui_reset_force));
+ (config, "brush-force", _("Force"),
+ _("Reset force to default"),
+ 0.1, 1.0, 0.0, 100.0, 1.0,
+ G_CALLBACK (gimp_paint_options_gui_reset_force));
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
@@ -225,6 +223,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
}
+
/* the "Link size to zoom" toggle */
if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]