pixman-gradient-walker: Make left_x and right_x 64 bit variables
authorSøren Sandmann Pedersen <ssp@redhat.com>
Thu, 24 Apr 2014 00:25:40 +0000 (20:25 -0400)
committerSøren Sandmann <ssp@redhat.com>
Thu, 15 May 2014 17:29:58 +0000 (13:29 -0400)
The variables left_x, and right_x in gradient_walker_reset() are
computed from pos, which is a 64 bit quantity, so to avoid overflows,
these variables must be 64 bit as well.

Similarly, the left_x and right_x that are stored in
pixman_gradient_walker_t need to be 64 bit as well; otherwise,
pixman_gradient_walker_pixel() will call reset too often.

This fixes the radial-invalid test, which was generating 'invalid'
floating point exceptions when the overflows caused color values to be
outside of [0, 255].

pixman/pixman-gradient-walker.c
pixman/pixman-private.h

index 5944a55..822f8e6 100644 (file)
@@ -54,7 +54,7 @@ static void
 gradient_walker_reset (pixman_gradient_walker_t *walker,
                       pixman_fixed_48_16_t      pos)
 {
-    int32_t x, left_x, right_x;
+    int64_t x, left_x, right_x;
     pixman_color_t *left_c, *right_c;
     int n, count = walker->num_stops;
     pixman_gradient_stop_t *stops = walker->stops;
index 6ca13b2..fdc966a 100644 (file)
@@ -345,8 +345,8 @@ typedef struct
     float                  r_s, r_b;
     float                  g_s, g_b;
     float                  b_s, b_b;
-    pixman_fixed_t         left_x;
-    pixman_fixed_t          right_x;
+    pixman_fixed_48_16_t    left_x;
+    pixman_fixed_48_16_t    right_x;
 
     pixman_gradient_stop_t *stops;
     int                     num_stops;