app: fix angle calculation of generated brushes

... so that we don't effectively take the absolute values of
angles.
This commit is contained in:
Ell 2017-12-22 16:27:06 -05:00
parent 067277340d
commit 27688ee752
1 changed files with 3 additions and 11 deletions

View File

@ -319,13 +319,9 @@ gimp_brush_generated_transform_size (GimpBrush *gbrush,
if (aspect_ratio < 0.0)
angle = angle + 0.25;
angle = fmod (fmod (angle, 1.0) + 1.0, 1.0);
angle *= 360;
if (angle < 0.0)
angle = -1.0 * fmod (angle, 180.0);
else if (angle > 180.0)
angle = fmod (angle, 180.0);
gimp_brush_generated_get_size (brush,
brush->shape,
brush->radius * scale,
@ -357,13 +353,9 @@ gimp_brush_generated_transform_mask (GimpBrush *gbrush,
if (aspect_ratio < 0.0)
angle = angle + 0.25;
angle = fmod (fmod (angle, 1.0) + 1.0, 1.0);
angle *= 360;
if (angle < 0.0)
angle = -1.0 * fmod (angle, 180.0);
else if (angle > 180.0)
angle = fmod (angle, 180.0);
if (scale == 1.0 &&
ratio == brush->aspect_ratio &&
angle == brush->angle &&
@ -605,7 +597,7 @@ gimp_brush_generated_get_size (GimpBrushGenerated *gbrush,
* allows for any angle to turn up.
**/
angle_in_degrees = ROUND (angle_in_degrees * 1000.0) / 1000.0;
angle_in_degrees = RINT (angle_in_degrees * 1000.0) / 1000.0;
s = sin (gimp_deg_to_rad (angle_in_degrees));
c = cos (gimp_deg_to_rad (angle_in_degrees));