diff options
Diffstat (limited to 'art_render_gradient.c')
-rw-r--r-- | art_render_gradient.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/art_render_gradient.c b/art_render_gradient.c index bf93c6f..008d61a 100644 --- a/art_render_gradient.c +++ b/art_render_gradient.c @@ -30,7 +30,9 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#if 0 #include <assert.h> +#endif /* Hack to find out how to define alloca on different platforms. * Modified version of glib/galloca.h. @@ -203,7 +205,9 @@ calc_color_at (ArtGradientStop *stops, } printf ("WARNING! bad ix %d in calc_color_at() [internal error]\n", ix); +#if 0 assert (0); +#endif } static void @@ -331,6 +335,7 @@ art_render_gradient_linear_render_8 (ArtRenderCallback *self, printf ("Initial ix: %d\n", ix); #endif +#if 0 assert (ix > 0); assert (ix < n_stops); assert ((stops[ix-1].offset <= offset_fraction + EPSILON) || @@ -344,6 +349,17 @@ art_render_gradient_linear_render_8 (ArtRenderCallback *self, assert ((offset_fraction != stops[ix].offset) || (d_offset <= 0.0)); */ +#else + if (!( (ix > 0) && (ix < n_stops) + && ((stops[ix-1].offset <= offset_fraction + EPSILON) || + ((stops[ix].offset > (1.0 - EPSILON)) + && (offset_fraction < EPSILON /* == 0.0*/))) + && (offset_fraction <= stops[ix].offset))) + { + printf ("art_render_gradient.c:%d: Old assert() failed!\n", __LINE__); + return; + } +#endif while (width > 0) { @@ -663,6 +679,18 @@ art_render_gradient_radial_render (ArtRenderCallback *self, ArtRender *render, z = b_a + sqrt (rad); else z = b_a; + + if (gradient->spread == ART_GRADIENT_PAD) + z = z; + else if (gradient->spread == ART_GRADIENT_REPEAT) + z = z - floor (z); + else /* (gradient->spread == ART_GRADIENT_REFLECT) */ + { + double tmp; + + tmp = z - 2 * floor (0.5 * z); + z = tmp > 1 ? 2 - tmp : tmp; + } art_render_gradient_setpix (render, bufp, n_stops, stops, z); bufp += pixstride; b_a += db_a; |