mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-13 12:25:53 +01:00
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 <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
e9764aab71
commit
7bf8efef54
@@ -52,7 +52,9 @@ RImage *RRotateImage(RImage * image, float angle)
|
|||||||
*/
|
*/
|
||||||
static const float min_usable_angle = 0.00699;
|
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) {
|
if (angle < min_usable_angle) {
|
||||||
/* Rotate by 0 degree */
|
/* Rotate by 0 degree */
|
||||||
|
|||||||
Reference in New Issue
Block a user