From: Christophe CURIS Date: Sun, 16 Jun 2013 19:51:02 +0000 (+0200) Subject: WRaster: Changed formula for reconverting angle to the (0-360) bounds X-Git-Tag: wmaker-0.95.5~13 X-Git-Url: https://repo.or.cz/w/wmaker-crm.git/commitdiff_plain/7bf8efef5423a45f8cb3ffabeeb2754188460a44 WRaster: Changed formula for reconverting angle to the (0-360) bounds There is a dedicaded floating point modulo operator that does a better job (faster, no precision loss), so we use it instead of the complicated formula that uses type conversions. Signed-off-by: Christophe CURIS --- diff --git a/wrlib/rotate.c b/wrlib/rotate.c index d296815a..f04b95eb 100644 --- a/wrlib/rotate.c +++ b/wrlib/rotate.c @@ -52,7 +52,9 @@ RImage *RRotateImage(RImage * image, float angle) */ static const float min_usable_angle = 0.00699; - angle = ((int)angle % 360) + (angle - (int)angle); + angle = fmod(angle, 360.0); + if (angle < 0.0) + angle += 360.0; if (angle < min_usable_angle) { /* Rotate by 0 degree */