mirror of https://github.com/GNOME/gimp.git
app: some cleanup in the new brush size code
This commit is contained in:
parent
5bc3317b5a
commit
ae742f0920
|
@ -367,12 +367,15 @@ gimp_brush_core_pre_paint (GimpPaintCore *paint_core,
|
|||
paint_core->pixel_dist);
|
||||
|
||||
scale = paint_options->brush_size /
|
||||
MAX (core->main_brush->mask->width, core->main_brush->mask->height) *
|
||||
MAX (core->main_brush->mask->width,
|
||||
core->main_brush->mask->height) *
|
||||
gimp_dynamics_output_get_linear_value (core->dynamics->size_output,
|
||||
¤t_coords,
|
||||
paint_options,
|
||||
fade_point);
|
||||
if (scale < 0.0001) return FALSE;
|
||||
|
||||
if (scale < 0.0001)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -948,7 +951,8 @@ gimp_brush_core_create_boundary (GimpBrushCore *core,
|
|||
g_return_if_fail (core->brush_bound_segs == NULL);
|
||||
|
||||
scale = paint_options->brush_size /
|
||||
MAX (core->main_brush->mask->width, core->main_brush->mask->height);
|
||||
MAX (core->main_brush->mask->width,
|
||||
core->main_brush->mask->height);
|
||||
|
||||
if (scale > 0.0)
|
||||
{
|
||||
|
@ -1696,27 +1700,27 @@ gimp_brush_core_eval_transform_dynamics (GimpPaintCore *paint_core,
|
|||
const GimpCoords *coords)
|
||||
{
|
||||
GimpBrushCore *core = GIMP_BRUSH_CORE (paint_core);
|
||||
GimpImage *image;
|
||||
gdouble fade_point = 1.0;
|
||||
|
||||
if (core->main_brush)
|
||||
{
|
||||
core->scale = paint_options->brush_size /
|
||||
MAX (core->main_brush->mask->width, core->main_brush->mask->height);
|
||||
}
|
||||
MAX (core->main_brush->mask->width,
|
||||
core->main_brush->mask->height);
|
||||
else
|
||||
core->scale = -1;
|
||||
|
||||
core->angle = paint_options->brush_angle;
|
||||
core->aspect_ratio = paint_options->brush_aspect_ratio;
|
||||
|
||||
if (!GIMP_IS_DYNAMICS (core->dynamics))
|
||||
if (! GIMP_IS_DYNAMICS (core->dynamics))
|
||||
return;
|
||||
|
||||
if (GIMP_BRUSH_CORE_GET_CLASS (core)->handles_dynamic_transforming_brush)
|
||||
{
|
||||
if (drawable)
|
||||
{
|
||||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
fade_point = gimp_paint_options_get_fade (paint_options, image,
|
||||
paint_core->pixel_dist);
|
||||
}
|
||||
|
@ -1745,7 +1749,6 @@ gimp_brush_core_eval_transform_dynamics (GimpPaintCore *paint_core,
|
|||
paint_options,
|
||||
fade_point);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -120,7 +120,6 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
|||
GtkObject *adj_angle;
|
||||
GtkObject *adj_aspect_ratio;
|
||||
|
||||
|
||||
button = gimp_prop_brush_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
|
||||
"brush-view-type", "brush-view-size");
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
|
||||
|
@ -147,10 +146,9 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
|||
"", 0.0, 0.5,
|
||||
button, 2, FALSE);
|
||||
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect(button, "clicked",
|
||||
G_CALLBACK(gimp_paint_options_gui_reset_size), options);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (gimp_paint_options_gui_reset_size),
|
||||
options);
|
||||
|
||||
adj_aspect_ratio = gimp_prop_scale_entry_new (config, "brush-aspect-ratio",
|
||||
GTK_TABLE (table), 0, table_row++,
|
||||
|
@ -344,11 +342,13 @@ static void
|
|||
gimp_paint_options_gui_reset_size (GtkWidget *button,
|
||||
GimpPaintOptions *paint_options)
|
||||
{
|
||||
GimpContext *context = GIMP_CONTEXT(paint_options);
|
||||
GimpBrush *brush = gimp_context_get_brush (context);
|
||||
GimpBrush *brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
|
||||
|
||||
if (brush)
|
||||
{
|
||||
paint_options->brush_size = MAX(brush->mask->width, brush->mask->height);
|
||||
g_object_notify(G_OBJECT(paint_options), "brush-size");
|
||||
g_object_set (paint_options,
|
||||
"brush-size", (gdouble) MAX (brush->mask->width,
|
||||
brush->mask->height),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue