]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
Explicitly check if r0 or r1 are NaN, as if they are, on x86 the function evaluates...
authorChris Young <chris@unsatisfactorysoftware.co.uk>
Sat, 5 Jan 2013 21:11:31 +0000 (21:11 +0000)
committerChris Young <chris@unsatisfactorysoftware.co.uk>
Sat, 5 Jan 2013 21:11:31 +0000 (21:11 +0000)
src/svgtiny_gradient.c

index 002c322a526262c6576d5fc631683bcd21e10912..e33002407be3fc73ed45ed219f3017623e3ab07b 100644 (file)
@@ -462,7 +462,13 @@ svgtiny_code svgtiny_add_path_linear_gradient(float *p, unsigned int n,
                                gradient_norm_squared;
 
                /* determine steps from change in r */
-               steps = ceilf(fabsf(r1 - r0) / 0.05);
+
+               if(isnan(r0) || isnan(r1)) {
+                       steps = 1;
+               } else {
+                       steps = ceilf(fabsf(r1 - r0) / 0.05);
+               }
+
                if (steps == 0)
                        steps = 1;
                fprintf(stderr, "r0 %g, r1 %g, steps %i\n",