From ca846806cbc4e11cd134e464c7740c1cde19422b Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Sun, 20 Jun 2010 13:12:27 -0400 Subject: [PATCH] Store the conical angle in floating point radians, not fixed point degrees This is a slight simplification. --- pixman/pixman-conical-gradient.c | 10 ++++++---- pixman/pixman-private.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pixman/pixman-conical-gradient.c b/pixman/pixman-conical-gradient.c index d06dd0b..897948b 100644 --- a/pixman/pixman-conical-gradient.c +++ b/pixman/pixman-conical-gradient.c @@ -70,7 +70,6 @@ conical_gradient_get_scanline_32 (pixman_image_t *image, double rx = x + 0.5; double ry = y + 0.5; double rz = 1.; - double a = pixman_fixed_to_double ((conical->angle * M_PI) / 180.0); _pixman_gradient_walker_init (&walker, gradient, source->common.repeat); @@ -108,7 +107,7 @@ conical_gradient_get_scanline_32 (pixman_image_t *image, { if (!mask || *mask++) { - double t = coordinates_to_parameter (rx, ry, a); + double t = coordinates_to_parameter (rx, ry, conical->angle); *buffer = _pixman_gradient_walker_pixel ( &walker, (pixman_fixed_48_16_t)pixman_double_to_fixed (t)); @@ -143,7 +142,7 @@ conical_gradient_get_scanline_32 (pixman_image_t *image, x -= conical->center.x / 65536.; y -= conical->center.y / 65536.; - t = coordinates_to_parameter (x, y, a); + t = coordinates_to_parameter (x, y, conical->angle); *buffer = _pixman_gradient_walker_pixel ( &walker, (pixman_fixed_48_16_t)pixman_double_to_fixed (t)); @@ -185,9 +184,12 @@ pixman_image_create_conical_gradient (pixman_point_fixed_t * center, return NULL; } + angle = MOD (angle, pixman_int_to_fixed (360)); + image->type = CONICAL; + conical->center = *center; - conical->angle = MOD (angle, 360 << 16); + conical->angle = (pixman_fixed_to_double (angle) / 180.0) * M_PI; image->common.property_changed = conical_gradient_property_changed; diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 5b0eff3..8718fcb 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -161,7 +161,7 @@ struct conical_gradient { gradient_t common; pixman_point_fixed_t center; - pixman_fixed_t angle; + double angle; }; struct bits_image -- 2.7.4