Commit b0d02666 authored by Alexia Death's avatar Alexia Death
Browse files

app: A few more generic aspect ratio fixes

parent 45a8d2c6
......@@ -300,23 +300,35 @@ gimp_brush_generated_transform_size (GimpBrush *gbrush,
GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (gbrush);
gint half_width;
gint half_height;
gdouble ratio;
/* Since generated brushes are symmetric the dont have intput
* for aspect ratios < 1.0. its same as rotate by 90 degrees and
* 1 / ratio. So we fix the input up for this case. */
if (aspect_ratio < 1.0)
if (aspect_ratio == 1.0)
{
aspect_ratio = 1.0 / aspect_ratio;
angle = angle + 0.25;
ratio = brush->aspect_ratio;
}
else
{
ratio = MIN (aspect_ratio, 20);
/* Since generated brushes are symmetric the dont have input
* for aspect ratios < 1.0. its same as rotate by 90 degrees and
* 1 / ratio. So we fix the input up for this case. */
if (ratio < 1.0)
{
ratio = MIN (1.0 / ratio, 20);
angle = angle + 0.25;
}
}
gimp_brush_generated_get_half_size (brush,
brush->shape,
brush->radius * scale,
brush->spikes,
brush->hardness,
MIN (brush->aspect_ratio * aspect_ratio, 20),
ratio,
(brush->angle + 360 * angle),
&half_width, &half_height,
NULL, NULL, NULL, NULL);
......@@ -333,23 +345,33 @@ gimp_brush_generated_transform_mask (GimpBrush *gbrush,
gdouble hardness)
{
GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (gbrush);
gdouble ratio;
/* Since generated brushes are symmetric the dont have intput
* for aspect ratios < 1.0. its same as rotate by extra 90 degrees and
* 1 / ratio. So we fix the input up for this case. */
if (aspect_ratio < 1.0)
if (aspect_ratio == 1.0)
{
aspect_ratio = 1.0 / aspect_ratio;
angle = angle + 0.25;
ratio = brush->aspect_ratio;
}
else
{
ratio = MIN (aspect_ratio, 20);
/* Since generated brushes are symmetric the dont have input
* for aspect ratios < 1.0. its same as rotate by 90 degrees and
* 1 / ratio. So we fix the input up for this case. */
if (ratio < 1.0)
{
ratio = MIN (1.0 / ratio, 20);
angle = angle + 0.25;
}
}
return gimp_brush_generated_calc (brush,
brush->shape,
brush->radius * scale ,
brush->spikes,
brush->hardness * hardness,
brush->aspect_ratio * aspect_ratio,
ratio,
(brush->angle + 360 * angle),
NULL, NULL);
}
......
......@@ -1025,13 +1025,18 @@ gimp_brush_core_transform_bound_segs (GimpBrushCore *core,
angle = core->angle;
aspect_ratio = core->aspect_ratio;
/* Generated brushes have their aspect ratio appled before base angle */
if (aspect_ratio != 1.0 && GIMP_IS_BRUSH_GENERATED (core->main_brush))
/* Generated brushes have their angle applied on top of base angle */
if (GIMP_IS_BRUSH_GENERATED (core->main_brush))
{
gdouble base_angle = gimp_brush_generated_get_angle (
GIMP_BRUSH_GENERATED (core->main_brush));
GimpBrushGenerated *generated_brush = GIMP_BRUSH_GENERATED (core->main_brush);
gdouble base_angle = gimp_brush_generated_get_angle (generated_brush);
angle = angle + base_angle / 360;
/* Dont apply the ratio. I wont make sense. The outlines for generated brushes need to be recreated */
aspect_ratio = 1.0;
}
height = core->brush_bound_width;
width = core->brush_bound_height;
......
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