mirror of https://github.com/GNOME/gimp.git
app: some cleanup in the new paint options code
This commit is contained in:
parent
6247d8978f
commit
c9e75b1fa0
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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 +
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue