Index: rl_addons/renderPM/gt1/gt1-namecontext.c =================================================================== --- rl_addons/renderPM/gt1/gt1-namecontext.c (revision 3457) +++ rl_addons/renderPM/gt1/gt1-namecontext.c (working copy) @@ -1,6 +1,7 @@ /* A module for a simple "name context", i.e. lisp-style atoms */ #include "gt1-misc.h" +#include "string.h" #include "gt1-namecontext.h" #if defined(_WIN32) || defined(macintosh) Index: rl_addons/renderPM/libart_lgpl/art_affine.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_affine.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_affine.c (working copy) @@ -124,7 +124,7 @@ *p++ = '-'; x = -x; } - if ((int)floor(x + EPSILON / 2) < 1) + if ((int)floor ((x + EPSILON / 2) < 1)) { *p++ = '0'; *p++ = '.'; @@ -147,7 +147,7 @@ x -= floor (x + EPSILON / 2); for (j = i; j < 6; j++) x *= 10; - ix = (int) floor (x + 0.5); + ix = floor (x + 0.5); for (j = 0; j < i; j++) ix *= 10; Index: rl_addons/renderPM/libart_lgpl/art_alphagamma.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_alphagamma.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_alphagamma.c (working copy) @@ -48,7 +48,7 @@ art_u8 *invtable; double s, r_gamma; - tablesize = (int) ceil (gamma * 8); + tablesize = ceil (gamma * 8); if (tablesize < 10) tablesize = 10; Index: rl_addons/renderPM/libart_lgpl/art_config.h =================================================================== --- rl_addons/renderPM/libart_lgpl/art_config.h (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_config.h (working copy) @@ -1,10 +1,10 @@ -#ifndef _ART_CONFIG_H -# define _ART_CONFIG_H -# define ART_SIZEOF_CHAR 1 -# define ART_SIZEOF_SHORT 2 -# define ART_SIZEOF_INT 4 -# define ART_SIZEOF_LONG 4 +/* Automatically generated by gen_art_config.c */ + +#define ART_SIZEOF_CHAR 1 +#define ART_SIZEOF_SHORT 2 +#define ART_SIZEOF_INT 4 +#define ART_SIZEOF_LONG 4 + typedef unsigned char art_u8; typedef unsigned short art_u16; typedef unsigned int art_u32; -#endif Index: rl_addons/renderPM/libart_lgpl/art_misc.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_misc.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_misc.c (working copy) @@ -23,7 +23,7 @@ #include "art_misc.h" #ifdef HAVE_UINSTD_H -# include +#include #endif #include #include @@ -60,6 +60,7 @@ vfprintf (stderr, fmt, ap); va_end (ap); } + /** * art_dprint: Print the debug message to stderr. * @fmt: The printf-style format for the debug message. @@ -72,11 +73,21 @@ va_list ap; va_start (ap, fmt); -#ifndef NOSTDERR vfprintf (stderr, fmt, ap); -#else - vfprintf (stdout, fmt, ap); -#endif va_end (ap); } +void *art_alloc(size_t size) +{ + return malloc(size); +} + +void art_free(void *ptr) +{ + free(ptr); +} + +void *art_realloc(void *ptr, size_t size) +{ + return realloc(ptr, size); +} Index: rl_addons/renderPM/libart_lgpl/art_misc.h =================================================================== --- rl_addons/renderPM/libart_lgpl/art_misc.h (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_misc.h (working copy) @@ -34,9 +34,15 @@ #include #endif -#define art_alloc malloc -#define art_free free -#define art_realloc realloc +#ifdef __cplusplus +extern "C" { +#endif +void *art_alloc(size_t size); +void art_free(void *ptr); +void *art_realloc(void *ptr, size_t size); +#ifdef __cplusplus +} +#endif /* __cplusplus */ /* These aren't, strictly speaking, configuration macros, but they're damn handy to have around, and may be worth playing with for @@ -66,9 +72,9 @@ */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)) #define ART_GNUC_PRINTF( format_idx, arg_idx ) \ - __attribute__((format (printf, format_idx, arg_idx))) + __attribute__((__format__ (__printf__, format_idx, arg_idx))) #define ART_GNUC_NORETURN \ - __attribute__((noreturn)) + __attribute__((__noreturn__)) #else /* !__GNUC__ */ #define ART_GNUC_PRINTF( format_idx, arg_idx ) #define ART_GNUC_NORETURN Index: rl_addons/renderPM/libart_lgpl/art_rect.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_rect.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_rect.c (working copy) @@ -208,8 +208,8 @@ void art_drect_to_irect (ArtIRect *dst, ArtDRect *src) { - dst->x0 = (int) floor (src->x0); - dst->y0 = (int) floor (src->y0); - dst->x1 = (int) ceil (src->x1); - dst->y1 = (int) ceil (src->y1); + dst->x0 = floor (src->x0); + dst->y0 = floor (src->y0); + dst->x1 = ceil (src->x1); + dst->y1 = ceil (src->y1); } Index: rl_addons/renderPM/libart_lgpl/art_rect_uta.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_rect_uta.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_rect_uta.c (working copy) @@ -88,7 +88,7 @@ (((bb & 0xffffff) ^ utiles[ix + 1]) & 0xffff00ff) == 0 && (((uta->x0 + x + 1) << ART_UTILE_SHIFT) + ART_UTA_BBOX_X1(utiles[ix + 1]) - - x0) <= (unsigned) max_width) + x0) <= max_width) { bb = utiles[ix + 1]; ix++; Index: rl_addons/renderPM/libart_lgpl/art_render.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_render.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_render.c (working copy) @@ -411,7 +411,7 @@ } else /* (depth == 16) */ { - tmp = ((art_u16 *)bufptr)[n_chan]; + tmp = ((art_u16 *)dstptr)[n_chan]; dst_alpha = (tmp + (tmp >> 15)); } if (alpha_type == ART_ALPHA_SEPARATE) @@ -487,7 +487,7 @@ for (j = 0; j < n_chan; j++) ((art_u16 *)dstptr)[j] = (dst[j] * dst_mul + 0x8000) >> 16; if (alpha_type != ART_ALPHA_NONE) - dstptr[n_chan] = (dst_alpha * 0xffff + 0x8000) >> 16; + ((art_u16 *)dstptr)[n_chan] = (dst_alpha * 0xffff + 0x8000) >> 16; } dstptr += dst_pixstride; } @@ -616,6 +616,7 @@ dst_save_mul = 0xff0000 / dst_alpha; } } + for (j = 0; j < n_chan; j++) { art_u32 src, dst; @@ -1250,7 +1251,7 @@ { rgb = rgbtab[0]; art_rgb_fill_run (dest, - (art_u8)(rgb >> 16), (art_u8)((rgb >> 8) & 0xff), (art_u8)(rgb & 0xff), + rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff, run_x1 - x0); } for (i = 0; i < n_run - 1; i++) @@ -1270,12 +1271,12 @@ else { art_rgb_fill_run (dest + ix, - (art_u8)(rgb >> 16), (art_u8)((rgb >> 8) & 0xff), (art_u8)(rgb & 0xff), + rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff, run_x1 - run_x0); } #else art_rgb_fill_run (dest + ix, - (art_u8)(rgb >> 16), (art_u8)((rgb >> 8) & 0xff), (art_u8)(rgb & 0xff), + rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff, run_x1 - run_x0); #endif } @@ -1288,7 +1289,7 @@ { rgb = rgbtab[0]; art_rgb_fill_run (dest + (run_x1 - x0) * 3, - (art_u8)(rgb >> 16), (art_u8)((rgb >> 8) & 0xff), (art_u8)(rgb & 0xff), + rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff, x1 - run_x1); } } Index: rl_addons/renderPM/libart_lgpl/art_render_gradient.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_render_gradient.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_render_gradient.c (working copy) @@ -63,15 +63,19 @@ typedef struct _ArtImageSourceGradLin ArtImageSourceGradLin; typedef struct _ArtImageSourceGradRad ArtImageSourceGradRad; +/* The stops will be copied right after this structure */ struct _ArtImageSourceGradLin { ArtImageSource super; - const ArtGradientLinear *gradient; + ArtGradientLinear gradient; + ArtGradientStop stops[1]; }; +/* The stops will be copied right after this structure */ struct _ArtImageSourceGradRad { ArtImageSource super; - const ArtGradientRadial *gradient; + ArtGradientRadial gradient; double a; + ArtGradientStop stops[1]; }; #define EPSILON 1e-6 @@ -184,7 +188,7 @@ int z; z0 = stops[ix - 1].color[j]; z1 = stops[ix].color[j]; - z = (int)floor (z0 + (z1 - z0) * interp + 0.5); + z = floor (z0 + (z1 - z0) * interp + 0.5); color[j] = ART_PIX_8_FROM_MAX (z); } return; @@ -208,7 +212,7 @@ art_u8 *dest, int y) { ArtImageSourceGradLin *z = (ArtImageSourceGradLin *)self; - const ArtGradientLinear *gradient = z->gradient; + const ArtGradientLinear *gradient = &(z->gradient); int i; int width = render->x1 - render->x0; int len; @@ -232,6 +236,7 @@ printf ("%f, ", gradient->stops[i].offset); } printf ("\n"); + printf ("a: %f, b: %f, c: %f\n", gradient->a, gradient->b, gradient->c); #endif offset = render->x0 * gradient->a + y * gradient->b + gradient->c; @@ -240,12 +245,12 @@ /* We need to force the gradient to extend the whole 0..1 segment, because the rest of the code doesn't handle partial gradients correctly */ - if ((gradient->stops[0].offset != 0.0) || - (gradient->stops[n_stops-1].offset != 1.0)) + if ((gradient->stops[0].offset > EPSILON /* == 0.0 */) || + (gradient->stops[n_stops-1].offset < (1.0 - EPSILON))) { extra_stops = 0; - tmp_stops = stops = (void *)alloca (sizeof (ArtGradientStop) * (n_stops + 2)); - if (gradient->stops[0].offset != 0.0) + tmp_stops = stops = alloca (sizeof (ArtGradientStop) * (n_stops + 2)); + if (gradient->stops[0].offset > EPSILON /* 0.0 */) { memcpy (tmp_stops, gradient->stops, sizeof (ArtGradientStop)); tmp_stops[0].offset = 0.0; @@ -253,7 +258,7 @@ extra_stops++; } memcpy (tmp_stops, gradient->stops, sizeof (ArtGradientStop) * n_stops); - if (gradient->stops[n_stops-1].offset != 1.0) + if (gradient->stops[n_stops-1].offset < (1.0 - EPSILON)) { tmp_stops += n_stops; memcpy (tmp_stops, &gradient->stops[n_stops-1], sizeof (ArtGradientStop)); @@ -277,7 +282,7 @@ if (spread == ART_GRADIENT_REFLECT) { tmp_stops = stops; - stops = (void *)alloca (sizeof (ArtGradientStop) * n_stops * 2); + stops = alloca (sizeof (ArtGradientStop) * n_stops * 2); memcpy (stops, tmp_stops, sizeof (ArtGradientStop) * n_stops); for (i = 0; i< n_stops; i++) @@ -308,17 +313,19 @@ printf ("inital offset: %f, fraction: %f d_offset: %f\n", offset, offset_fraction, d_offset); #endif /* ix is selected so that offset_fraction is - stops[ix-1] <= offset_fraction <= stops[x1] + stops[ix-1] <= offset_fraction <= stops[ix] If offset_fraction is equal to one of the edges, ix is selected so the the section of the line extending in the same direction as d_offset is between ix-1 and ix. */ for (ix = 0; ix < n_stops; ix++) if (stops[ix].offset > offset_fraction || - (d_offset < 0.0 && stops[ix].offset == offset_fraction)) + (d_offset < 0.0 && fabs (stops[ix].offset - offset_fraction) < EPSILON)) break; if (ix == 0) ix = n_stops - 1; + else if (ix == n_stops) + ix = n_stops - 1; #ifdef DEBUG_SPEW printf ("Initial ix: %d\n", ix); @@ -326,13 +333,17 @@ assert (ix > 0); assert (ix < n_stops); - assert ((stops[ix-1].offset <= offset_fraction) || - ((stops[ix].offset == 1.0) && (offset_fraction == 0.0))); + assert ((stops[ix-1].offset <= offset_fraction + EPSILON) || + ((stops[ix].offset > (1.0 - EPSILON)) && (offset_fraction < EPSILON /* == 0.0*/))); assert (offset_fraction <= stops[ix].offset); + /* FIXME: These asserts may be broken, it is for now + safer to not use them. Should be fixed! + See bug #121850 assert ((offset_fraction != stops[ix-1].offset) || (d_offset >= 0.0)); assert ((offset_fraction != stops[ix].offset) || (d_offset <= 0.0)); + */ while (width > 0) { @@ -344,7 +355,7 @@ spread, offset, offset_fraction, - (d_offset > 0.0), + (d_offset > -EPSILON), ix, color1); @@ -391,7 +402,7 @@ spread, offset, offset_fraction, - (d_offset < 0.0), + (d_offset < EPSILON), ix, color2); @@ -411,14 +422,14 @@ if (ix == n_stops) ix = 1; /* Note: offset_fraction can actually be one here on x86 machines that - does calculations with extanded precision, but later rounds to 64bit. + does calculations with extended precision, but later rounds to 64bit. This happens if the 80bit offset_fraction is larger than the largest 64bit double that is less than one. */ } while (!((stops[ix-1].offset <= offset_fraction && offset_fraction < stops[ix].offset) || - (ix == 1 && offset_fraction == 1.0))); + (ix == 1 && offset_fraction > (1.0 - EPSILON)))); } else { @@ -430,7 +441,7 @@ } while (!((stops[ix-1].offset < offset_fraction && offset_fraction <= stops[ix].offset) || - (ix == n_stops - 1 && offset_fraction == 0.0))); + (ix == n_stops - 1 && offset_fraction < EPSILON /* == 0.0*/))); } bufp += 4*len; @@ -481,7 +492,7 @@ int z; z0 = stops[ix - 1].color[j]; z1 = stops[ix].color[j]; - z = (int)floor (z0 + (z1 - z0) * interp + 0.5); + z = floor (z0 + (z1 - z0) * interp + 0.5); if (render->buf_depth == 8) dst[j] = ART_PIX_8_FROM_MAX (z); else /* (render->buf_depth == 16) */ @@ -515,7 +526,7 @@ art_u8 *dest, int y) { ArtImageSourceGradLin *z = (ArtImageSourceGradLin *)self; - const ArtGradientLinear *gradient = z->gradient; + const ArtGradientLinear *gradient = &(z->gradient); int pixstride = (render->n_chan + 1) * (render->depth >> 3); int x; int width = render->x1 - render->x0; @@ -582,13 +593,17 @@ const ArtGradientLinear *gradient, ArtFilterLevel level) { - ArtImageSourceGradLin *image_source = art_new (ArtImageSourceGradLin, 1); + ArtImageSourceGradLin *image_source = art_alloc (sizeof (ArtImageSourceGradLin) + + sizeof (ArtGradientStop) * (gradient->n_stops - 1)); image_source->super.super.render = NULL; image_source->super.super.done = art_render_gradient_linear_done; image_source->super.negotiate = art_render_gradient_linear_negotiate; - image_source->gradient = gradient; + /* copy the gradient into the structure */ + image_source->gradient = *gradient; + image_source->gradient.stops = image_source->stops; + memcpy (image_source->gradient.stops, gradient->stops, sizeof (ArtGradientStop) * gradient->n_stops); art_render_add_image_source (render, &image_source->super); } @@ -604,7 +619,7 @@ art_u8 *dest, int y) { ArtImageSourceGradRad *z = (ArtImageSourceGradRad *)self; - const ArtGradientRadial *gradient = z->gradient; + const ArtGradientRadial *gradient = &(z->gradient); int pixstride = (render->n_chan + 1) * (render->depth >> 3); int x; int x0 = render->x0; @@ -680,7 +695,8 @@ const ArtGradientRadial *gradient, ArtFilterLevel level) { - ArtImageSourceGradRad *image_source = art_new (ArtImageSourceGradRad, 1); + ArtImageSourceGradRad *image_source = art_alloc (sizeof (ArtImageSourceGradRad) + + sizeof (ArtGradientStop) * (gradient->n_stops - 1)); double fx = gradient->fx; double fy = gradient->fy; @@ -688,7 +704,11 @@ image_source->super.super.done = art_render_gradient_radial_done; image_source->super.negotiate = art_render_gradient_radial_negotiate; - image_source->gradient = gradient; + /* copy the gradient into the structure */ + image_source->gradient = *gradient; + image_source->gradient.stops = image_source->stops; + memcpy (image_source->gradient.stops, gradient->stops, sizeof (ArtGradientStop) * gradient->n_stops); + /* todo: sanitycheck fx, fy? */ image_source->a = 1 - fx * fx - fy * fy; Index: rl_addons/renderPM/libart_lgpl/art_rgb_a_affine.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_rgb_a_affine.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_rgb_a_affine.c (working copy) @@ -107,8 +107,8 @@ { pt.x = x + 0.5; art_affine_point (&src_pt, &pt, inv); - src_x = (int)floor (src_pt.x); - src_y = (int)floor (src_pt.y); + src_x = floor (src_pt.x); + src_y = floor (src_pt.y); src_p = src + (src_y * src_rowstride) + src_x; if (src_x >= 0 && src_x < src_width && src_y >= 0 && src_y < src_height) Index: rl_addons/renderPM/libart_lgpl/art_rgb_affine.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_rgb_affine.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_rgb_affine.c (working copy) @@ -93,8 +93,8 @@ { pt.x = x + 0.5; art_affine_point (&src_pt, &pt, inv); - src_x = (int)floor (src_pt.x); - src_y = (int)floor (src_pt.y); + src_x = floor (src_pt.x); + src_y = floor (src_pt.y); src_p = src + (src_y * src_rowstride) + src_x * 3; dst_p[0] = src_p[0]; dst_p[1] = src_p[1]; Index: rl_addons/renderPM/libart_lgpl/art_rgb_affine_private.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_rgb_affine_private.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_rgb_affine_private.c (working copy) @@ -57,11 +57,11 @@ { z = affine[2] * (y + 0.5) + affine[4]; x_intercept = -z / affine[0]; - xi = (int) ceil (x_intercept + EPSILON - 0.5); + xi = ceil (x_intercept + EPSILON - 0.5); if (xi > x0) x0 = xi; x_intercept = (-z + src_width) / affine[0]; - xi = (int) ceil (x_intercept - EPSILON - 0.5); + xi = ceil (x_intercept - EPSILON - 0.5); if (xi < x1) x1 = xi; } @@ -69,11 +69,11 @@ { z = affine[2] * (y + 0.5) + affine[4]; x_intercept = (-z + src_width) / affine[0]; - xi = (int) ceil (x_intercept + EPSILON - 0.5); + xi = ceil (x_intercept + EPSILON - 0.5); if (xi > x0) x0 = xi; x_intercept = -z / affine[0]; - xi = (int) ceil (x_intercept - EPSILON - 0.5); + xi = ceil (x_intercept - EPSILON - 0.5); if (xi < x1) x1 = xi; } @@ -92,11 +92,11 @@ { z = affine[3] * (y + 0.5) + affine[5]; x_intercept = -z / affine[1]; - xi = (int) ceil (x_intercept + EPSILON - 0.5); + xi = ceil (x_intercept + EPSILON - 0.5); if (xi > x0) x0 = xi; x_intercept = (-z + src_height) / affine[1]; - xi = (int) ceil (x_intercept - EPSILON - 0.5); + xi = ceil (x_intercept - EPSILON - 0.5); if (xi < x1) x1 = xi; } @@ -104,11 +104,11 @@ { z = affine[3] * (y + 0.5) + affine[5]; x_intercept = (-z + src_height) / affine[1]; - xi = (int) ceil (x_intercept + EPSILON - 0.5); + xi = ceil (x_intercept + EPSILON - 0.5); if (xi > x0) x0 = xi; x_intercept = -z / affine[1]; - xi = (int) ceil (x_intercept - EPSILON - 0.5); + xi = ceil (x_intercept - EPSILON - 0.5); if (xi < x1) x1 = xi; } Index: rl_addons/renderPM/libart_lgpl/art_rgb_bitmap_affine.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_rgb_bitmap_affine.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_rgb_bitmap_affine.c (working copy) @@ -73,8 +73,8 @@ { pt.x = x + 0.5; art_affine_point (&src_pt, &pt, inv); - src_x = (int)floor (src_pt.x); - src_y = (int)floor (src_pt.y); + src_x = floor (src_pt.x); + src_y = floor (src_pt.y); src_p = src + (src_y * src_rowstride) + (src_x >> 3); if (*src_p & (128 >> (src_x & 7))) { @@ -174,8 +174,8 @@ { pt.x = x + 0.5; art_affine_point (&src_pt, &pt, inv); - src_x = (int)floor (src_pt.x); - src_y = (int)floor (src_pt.y); + src_x = floor (src_pt.x); + src_y = floor (src_pt.y); src_p = src + (src_y * src_rowstride) + (src_x >> 3); if (*src_p & (128 >> (src_x & 7))) { Index: rl_addons/renderPM/libart_lgpl/art_rgb_rgba_affine.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_rgb_rgba_affine.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_rgb_rgba_affine.c (working copy) @@ -100,8 +100,8 @@ { pt.x = x + 0.5; art_affine_point (&src_pt, &pt, inv); - src_x = (int)floor (src_pt.x); - src_y = (int)floor (src_pt.y); + src_x = floor (src_pt.x); + src_y = floor (src_pt.y); src_p = src + (src_y * src_rowstride) + src_x * 4; if (src_x >= 0 && src_x < src_width && src_y >= 0 && src_y < src_height) Index: rl_addons/renderPM/libart_lgpl/art_rgb_svp.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_rgb_svp.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_rgb_svp.c (working copy) @@ -67,7 +67,7 @@ { rgb = data->rgbtab[(running_sum >> 16) & 0xff]; art_rgb_fill_run (linebuf, - (art_u8)(rgb >> 16), (art_u8)((rgb >> 8) & 0xff), (art_u8)(rgb & 0xff), + rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff, run_x1 - x0); } @@ -80,7 +80,7 @@ { rgb = data->rgbtab[(running_sum >> 16) & 0xff]; art_rgb_fill_run (linebuf + (run_x0 - x0) * 3, - (art_u8)(rgb >> 16), (art_u8)((rgb >> 8) & 0xff), (art_u8)(rgb & 0xff), + rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff, run_x1 - run_x0); } } @@ -89,7 +89,7 @@ { rgb = data->rgbtab[(running_sum >> 16) & 0xff]; art_rgb_fill_run (linebuf + (run_x1 - x0) * 3, - (art_u8)(rgb >> 16), (art_u8)((rgb >> 8) & 0xff), (art_u8)(rgb & 0xff), + rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff, x1 - run_x1); } } @@ -97,7 +97,7 @@ { rgb = data->rgbtab[(running_sum >> 16) & 0xff]; art_rgb_fill_run (linebuf, - (art_u8)(rgb >> 16), (art_u8)((rgb >> 8) & 0xff), (art_u8)(rgb & 0xff), + rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff, x1 - x0); } Index: rl_addons/renderPM/libart_lgpl/art_svp_ops.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_svp_ops.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_svp_ops.c (working copy) @@ -286,19 +286,12 @@ #ifdef ART_USE_NEW_INTERSECTOR ArtSVP *svp3, *svp_new; ArtSvpWriter *swr; -#ifdef ROBIN_DEBUG - dump_svp("art_svp_intersect svp1", svp1); - dump_svp("art_svp_intersect svp2", svp2); -#endif svp3 = art_svp_merge (svp1, svp2); swr = art_svp_writer_rewind_new (ART_WIND_RULE_INTERSECT); art_svp_intersector (svp3, swr); svp_new = art_svp_writer_rewind_reap (swr); art_free (svp3); /* shallow free because svp3 contains shared segments */ -#ifdef ROBIN_DEBUG - dump_svp("art_svp_intersect svp_new", svp_new); -#endif return svp_new; #else @@ -378,4 +371,31 @@ #endif } -/* todo: implement minus */ +#ifdef ART_USE_NEW_INTERSECTOR +ArtSVP * +art_svp_minus (const ArtSVP *svp1, const ArtSVP *svp2) +{ + ArtSVP *svp2_mod; + ArtSVP *svp3, *svp_new; + ArtSvpWriter *swr; + int i; + + svp2_mod = (ArtSVP *) svp2; /* get rid of the const for a while */ + + /* First invert svp2 to "turn it inside out" */ + for (i = 0; i < svp2_mod->n_segs; i++) + svp2_mod->segs[i].dir = !svp2_mod->segs[i].dir; + + svp3 = art_svp_merge (svp1, svp2_mod); + swr = art_svp_writer_rewind_new (ART_WIND_RULE_POSITIVE); + art_svp_intersector (svp3, swr); + svp_new = art_svp_writer_rewind_reap (swr); + art_free (svp3); /* shallow free because svp3 contains shared segments */ + + /* Flip svp2 back to its original state */ + for (i = 0; i < svp2_mod->n_segs; i++) + svp2_mod->segs[i].dir = !svp2_mod->segs[i].dir; + + return svp_new; +} +#endif /* ART_USE_NEW_INTERSECTOR */ Index: rl_addons/renderPM/libart_lgpl/art_svp_render_aa.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_svp_render_aa.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_svp_render_aa.c (working copy) @@ -275,25 +275,25 @@ x_min = x_bot; x_max = x_top; } - ix_min = (int)floor (x_min); - ix_max = (int)floor (x_max); + ix_min = floor (x_min); + ix_max = floor (x_max); if (ix_min >= x1) { /* skip; it starts to the right of the render region */ } else if (ix_max < x0) /* it ends to the left of the render region */ - start += (int)delta; + start += delta; else if (ix_min == ix_max) { /* case 1, antialias a single pixel */ - xdelta = (int)((ix_min + 1 - (x_min + x_max) * 0.5) * delta); + xdelta = (ix_min + 1 - (x_min + x_max) * 0.5) * delta; ADD_STEP(ix_min, xdelta) if (ix_min + 1 < x1) { - xdelta = (int)(delta - xdelta); + xdelta = delta - xdelta; ADD_STEP(ix_min + 1, xdelta) } @@ -304,8 +304,8 @@ rslope = 1.0 / fabs (seg_dx[seg_index]); drslope = delta * rslope; last = - (int)(drslope * 0.5 * - (ix_min + 1 - x_min) * (ix_min + 1 - x_min)); + drslope * 0.5 * + (ix_min + 1 - x_min) * (ix_min + 1 - x_min); xdelta = last; if (ix_min >= x0) { @@ -322,8 +322,8 @@ ix_max = x1; for (; x < ix_max; x++) { - this = (int)((seg->dir ? 16711680.0 : -16711680.0) * rslope * - (x + 0.5 - x_min)); + this = (seg->dir ? 16711680.0 : -16711680.0) * rslope * + (x + 0.5 - x_min); xdelta = this - last; last = this; @@ -332,9 +332,9 @@ if (x < x1) { this = - (int)(delta * (1 - 0.5 * + delta * (1 - 0.5 * (x_max - ix_max) * (x_max - ix_max) * - rslope)); + rslope); xdelta = this - last; last = this; @@ -342,7 +342,7 @@ if (x + 1 < x1) { - xdelta = (int)(delta - last); + xdelta = delta - last; ADD_STEP(x + 1, xdelta) } Index: rl_addons/renderPM/libart_lgpl/art_svp_vpath_stroke.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_svp_vpath_stroke.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_svp_vpath_stroke.c (working copy) @@ -69,13 +69,13 @@ { /* curve to the left */ if (th_0 < th_1) th_0 += M_PI * 2; - n_pts = (int)ceil ((th_0 - th_1) / theta); + n_pts = ceil ((th_0 - th_1) / theta); } else { /* curve to the right */ if (th_1 < th_0) th_1 += M_PI * 2; - n_pts = (int)ceil ((th_1 - th_0) / theta); + n_pts = ceil ((th_1 - th_0) / theta); } #ifdef VERBOSE printf ("start %f %f; th_0 = %f, th_1 = %f, r = %f, theta = %f\n", x0, y0, th_0, th_1, radius, theta); @@ -360,7 +360,7 @@ ART_LINETO, vpath[i1].x + dlx0, vpath[i1].y + dly0); break; case ART_PATH_STROKE_CAP_ROUND: - n_pts = (int)ceil (M_PI / (2.0 * M_SQRT2 * sqrt (flatness / line_width))); + n_pts = ceil (M_PI / (2.0 * M_SQRT2 * sqrt (flatness / line_width))); art_vpath_add_point (p_result, pn_result, pn_result_max, ART_LINETO, vpath[i1].x - dlx0, vpath[i1].y - dly0); for (i = 1; i < n_pts; i++) Index: rl_addons/renderPM/libart_lgpl/art_svp_wind.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_svp_wind.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_svp_wind.c (working copy) @@ -26,18 +26,13 @@ #include "config.h" #include "art_svp_wind.h" -#include /* for fprintf of debugging info */ +#include /* for printf of debugging info */ #include /* for memcpy */ #include #include "art_misc.h" #include "art_rect.h" #include "art_svp.h" -#ifdef NOSTDERR -# define STDERR stdout -#else -# define STDERR stderr -#endif #define noVERBOSE @@ -193,7 +188,7 @@ { if (d1 > 0) return 1; else if (d1 < 0) return -1; - else fprintf (STDERR,"case 1 degenerate\n"); + else printf ("case 1 degenerate\n"); return 0; } else /* d0 < 0 */ @@ -231,7 +226,7 @@ { if (d3 > 0) return -1; else if (d3 < 0) return 1; - else fprintf (STDERR,"case 2 degenerate\n"); + else printf ("case 2 degenerate\n"); return 0; } else /* d2 < 0 */ @@ -268,7 +263,7 @@ if (d3 > 0) return -1; else if (d3 < 0) return 1; else - fprintf (STDERR, "colinear!\n"); + fprintf (stderr, "colinear!\n"); } else /* d2 < 0 */ { @@ -296,7 +291,7 @@ if (d1 > 0) return 1; else if (d1 < 0) return -1; else - fprintf (STDERR, "colinear!\n"); + fprintf (stderr, "colinear!\n"); } else /* d0 < 0 */ { @@ -340,7 +335,7 @@ if (z0.x == z1.x && z1.x == z2.x && z2.x == z3.x) { - fprintf (STDERR, "x_order_2: colinear and horizontally aligned!\n"); + art_dprint ("x_order_2: colinear and horizontally aligned!\n"); return 0; } @@ -349,7 +344,7 @@ if (z0.x >= z2.x && z1.x >= z2.x && z0.x >= z3.x && z1.x >= z3.x) return 1; - fprintf (STDERR, "x_order_2: colinear!\n"); + fprintf (stderr, "x_order_2: colinear!\n"); return 0; } @@ -378,7 +373,7 @@ y = vp->segs[0].points[0].y; while (seg_idx < vp->n_segs || n_active_segs > 0) { - fprintf (STDERR,"y = %g\n", y); + printf ("y = %g\n", y); /* delete segments ending at y from active list */ for (i = 0; i < n_active_segs; i++) { @@ -386,7 +381,7 @@ if (vp->segs[asi].n_points - 1 == cursor[asi] && vp->segs[asi].points[cursor[asi]].y == y) { - fprintf (STDERR,"deleting %d\n", asi); + printf ("deleting %d\n", asi); n_active_segs--; for (j = i; j < n_active_segs; j++) active_segs[j] = active_segs[j + 1]; @@ -398,7 +393,7 @@ while (seg_idx < vp->n_segs && y == vp->segs[seg_idx].points[0].y) { cursor[seg_idx] = 0; - fprintf (STDERR,"inserting %d\n", seg_idx); + printf ("inserting %d\n", seg_idx); for (i = 0; i < n_active_segs; i++) { asi = active_segs[i]; @@ -425,7 +420,7 @@ for (i = 0; i < n_active_segs; i++) { asi = active_segs[i]; - fprintf (STDERR,"%d (%g, %g) - (%g, %g) %s\n", asi, + printf ("%d (%g, %g) - (%g, %g) %s\n", asi, vp->segs[asi].points[cursor[asi]].x, vp->segs[asi].points[cursor[asi]].y, vp->segs[asi].points[cursor[asi] + 1].x, @@ -462,7 +457,7 @@ y >= vp->segs[asi].points[cursor[asi] + 1].y) cursor[asi]++; } - fprintf (STDERR,"\n"); + printf ("\n"); } art_free (cursor); art_free (active_segs); @@ -536,7 +531,7 @@ if (intersect_lines (z0, z1, z2, z3, &ip)) { #ifdef VERBOSE - fprintf (STDERR,"new intersection point: (%g, %g)\n", ip.x, ip.y); + printf ("new intersection point: (%g, %g)\n", ip.x, ip.y); #endif insert_ip (asi01, n_ips, n_ips_max, ips, ip); insert_ip (asi23, n_ips, n_ips_max, ips, ip); @@ -579,7 +574,7 @@ { #ifdef VERBOSE - fprintf (STDERR,"svp_add_point: cross on left!\n"); + printf ("svp_add_point: cross on left!\n"); #endif } } @@ -601,7 +596,7 @@ p) > -1) { #ifdef VERBOSE - fprintf (STDERR,"svp_add_point: cross on right!\n"); + printf ("svp_add_point: cross on right!\n"); #endif } } @@ -655,14 +650,14 @@ break; #ifdef VERBOSE - fprintf (STDERR,"point matches on left (%g, %g) - (%g, %g) x (%g, %g) - (%g, %g)!\n", + printf ("point matches on left (%g, %g) - (%g, %g) x (%g, %g) - (%g, %g)!\n", p0l.x, p0l.y, p1l.x, p1l.y, p0.x, p0.y, p1.x, p1.y); #endif if (x_order (p0l, p1l, p0, p1) == 1) break; #ifdef VERBOSE - fprintf (STDERR,"scanning to the left (i=%d, target=%d)\n", i, target); + printf ("scanning to the left (i=%d, target=%d)\n", i, target); #endif } @@ -680,14 +675,14 @@ break; #ifdef VERBOSE - fprintf (STDERR,"point matches on left (%g, %g) - (%g, %g) x (%g, %g) - (%g, %g)!\n", + printf ("point matches on left (%g, %g) - (%g, %g) x (%g, %g) - (%g, %g)!\n", p0.x, p0.y, p1.x, p1.y, p0r.x, p0r.y, p1r.x, p1r.y); #endif if (x_order (p0r, p1r, p0, p1) == 1) break; #ifdef VERBOSE - fprintf (STDERR,"scanning to the right (i=%d, target=%d)\n", i, target); + printf ("scanning to the right (i=%d, target=%d)\n", i, target); #endif } @@ -728,10 +723,10 @@ ArtPoint *pts; #ifdef VERBOSE - fprintf (STDERR,"fix_crossing: [%d..%d)", start, end); + printf ("fix_crossing: [%d..%d)", start, end); for (k = 0; k < n_active_segs; k++) - fprintf (STDERR," %d", active_segs[k]); - fprintf (STDERR,"\n"); + printf (" %d", active_segs[k]); + printf ("\n"); #endif if (start == -1) @@ -773,7 +768,7 @@ swap = 1; #ifdef VERBOSE - fprintf (STDERR,"fix_crossing: at %i should be %i\n", i, target); + printf ("fix_crossing: at %i should be %i\n", i, target); #endif /* let's close off all relevant segments */ @@ -792,7 +787,7 @@ int seg_num; /* so break here */ #ifdef VERBOSE - fprintf (STDERR,"closing off %d\n", j); + printf ("closing off %d\n", j); #endif pts = art_new (ArtPoint, 16); @@ -823,7 +818,7 @@ if (cursor[as_start] < vp->segs[as_start].n_points) { #ifdef VERBOSE - fprintf (STDERR,"checking intersection of %d, %d\n", start - 1, start); + printf ("checking intersection of %d, %d\n", start - 1, start); #endif intersect_neighbors (start, active_segs, n_ips, n_ips_max, ips, @@ -839,7 +834,7 @@ if (cursor[as_end] < vp->segs[as_end].n_points) { #ifdef VERBOSE - fprintf (STDERR,"checking intersection of %d, %d\n", end - 1, end); + printf ("checking intersection of %d, %d\n", end - 1, end); #endif intersect_neighbors (end, active_segs, n_ips, n_ips_max, ips, @@ -849,10 +844,10 @@ if (swap) { #ifdef VERBOSE - fprintf (STDERR,"fix_crossing return: [%d..%d)", start, end); + printf ("fix_crossing return: [%d..%d)", start, end); for (k = 0; k < n_active_segs; k++) - fprintf (STDERR," %d", active_segs[k]); - fprintf (STDERR,"\n"); + printf (" %d", active_segs[k]); + printf ("\n"); #endif } } @@ -1032,7 +1027,7 @@ while (seg_idx < vp->n_segs || n_active_segs > 0) { #ifdef VERBOSE - fprintf (STDERR,"y = %g\n", y); + printf ("y = %g\n", y); #endif /* maybe move deletions to end of loop (to avoid so much special @@ -1048,7 +1043,7 @@ do { #ifdef VERBOSE - fprintf (STDERR,"deleting %d\n", asi); + printf ("deleting %d\n", asi); #endif art_free (ips[asi]); n_active_segs--; @@ -1076,7 +1071,7 @@ while (seg_idx < vp->n_segs && y == vp->segs[seg_idx].points[0].y) { #ifdef VERBOSE - fprintf (STDERR,"inserting %d\n", seg_idx); + printf ("inserting %d\n", seg_idx); #endif cursor[seg_idx] = 0; for (i = 0; i < n_active_segs; i++) @@ -1135,12 +1130,12 @@ for (i = 0; i < n_active_segs; i++) { asi = active_segs[i]; - fprintf (STDERR,"%d ", asi); + printf ("%d ", asi); for (j = 0; j < n_ips[asi]; j++) - fprintf (STDERR,"(%g, %g) - ", + printf ("(%g, %g) - ", ips[asi][j].x, ips[asi][j].y); - fprintf (STDERR,"(%g, %g) %s\n", + printf ("(%g, %g) %s\n", vp->segs[asi].points[cursor[asi] + 1].x, vp->segs[asi].points[cursor[asi] + 1].y, vp->segs[asi].dir ? "v" : "^"); @@ -1253,7 +1248,7 @@ &n_segs_max, &n_points_max); #ifdef VERBOSE - fprintf (STDERR,"\n"); + printf ("\n"); #endif } @@ -1265,7 +1260,7 @@ int k; for (k = 0; k < new_vp->n_segs - 1; k++) { - fprintf (STDERR,"(%g, %g) - (%g, %g) %s (%g, %g) - (%g, %g)\n", + printf ("(%g, %g) - (%g, %g) %s (%g, %g) - (%g, %g)\n", new_vp->segs[k].points[0].x, new_vp->segs[k].points[0].y, new_vp->segs[k].points[1].x, @@ -1385,7 +1380,7 @@ while (seg_idx < vp->n_segs || n_active_segs > 0) { #ifdef VERBOSE - fprintf (STDERR,"y = %g\n", y); + printf ("y = %g\n", y); #endif /* delete segments ending at y from active list */ for (i = 0; i < n_active_segs; i++) @@ -1395,7 +1390,7 @@ vp->segs[asi].points[cursor[asi]].y == y) { #ifdef VERBOSE - fprintf (STDERR,"deleting %d\n", asi); + printf ("deleting %d\n", asi); #endif n_active_segs--; for (j = i; j < n_active_segs; j++) @@ -1408,7 +1403,7 @@ while (seg_idx < vp->n_segs && y == vp->segs[seg_idx].points[0].y) { #ifdef VERBOSE - fprintf (STDERR,"inserting %d\n", seg_idx); + printf ("inserting %d\n", seg_idx); #endif cursor[seg_idx] = 0; for (i = 0; i < n_active_segs; i++) @@ -1467,7 +1462,7 @@ int new_dir; #ifdef VERBOSE - fprintf (STDERR,"keeping segment %d\n", seg_idx); + printf ("keeping segment %d\n", seg_idx); #endif n_points = vp->segs[seg_idx].n_points; points = vp->segs[seg_idx].points; @@ -1498,7 +1493,7 @@ for (i = 0; i < n_active_segs; i++) { asi = active_segs[i]; - fprintf (STDERR,"%d:%d (%g, %g) - (%g, %g) %s %d\n", asi, + printf ("%d:%d (%g, %g) - (%g, %g) %s %d\n", asi, cursor[asi], vp->segs[asi].points[cursor[asi]].x, vp->segs[asi].points[cursor[asi]].y, @@ -1539,7 +1534,7 @@ cursor[asi]++; } #ifdef VERBOSE - fprintf (STDERR,"\n"); + printf ("\n"); #endif } art_free (cursor); Index: rl_addons/renderPM/libart_lgpl/art_uta_vpath.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_uta_vpath.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_uta_vpath.c (working copy) @@ -69,14 +69,14 @@ int ix, ix1; ArtUtaBbox bb; - xmin = (int)floor (MIN(x0, x1)); + xmin = floor (MIN(x0, x1)); xmax = MAX(x0, x1); - xmaxf = (int)floor (xmax); - xmaxc = (int)ceil (xmax); - ymin = (int)floor (MIN(y0, y1)); + xmaxf = floor (xmax); + xmaxc = ceil (xmax); + ymin = floor (MIN(y0, y1)); ymax = MAX(y0, y1); - ymaxf = (int)floor (ymax); - ymaxc = (int)ceil (ymax); + ymaxf = floor (ymax); + ymaxc = ceil (ymax); xt0 = (xmin >> ART_UTILE_SHIFT) - uta->x0; yt0 = (ymin >> ART_UTILE_SHIFT) - uta->y0; xt1 = (xmaxf >> ART_UTILE_SHIFT) - uta->x0; @@ -94,10 +94,10 @@ if (bb == 0) bb = ART_UTA_BBOX_CONS(xf0, yf0, xf1, yf1); else - bb = ART_UTA_BBOX_CONS(MIN(ART_UTA_BBOX_X0(bb), (unsigned)xf0), - MIN(ART_UTA_BBOX_Y0(bb), (unsigned)yf0), - MAX(ART_UTA_BBOX_X1(bb), (unsigned)xf1), - MAX(ART_UTA_BBOX_Y1(bb), (unsigned)yf1)); + bb = ART_UTA_BBOX_CONS(MIN(ART_UTA_BBOX_X0(bb), xf0), + MIN(ART_UTA_BBOX_Y0(bb), yf0), + MAX(ART_UTA_BBOX_X1(bb), xf1), + MAX(ART_UTA_BBOX_Y1(bb), yf1)); uta->utiles[ix] = bb; } else @@ -125,10 +125,10 @@ if (bb == 0) bb = ART_UTA_BBOX_CONS(xf0, yf0, ART_UTILE_SIZE, yf1); else - bb = ART_UTA_BBOX_CONS(MIN(ART_UTA_BBOX_X0(bb), (unsigned)xf0), - MIN(ART_UTA_BBOX_Y0(bb), (unsigned)yf0), + bb = ART_UTA_BBOX_CONS(MIN(ART_UTA_BBOX_X0(bb), xf0), + MIN(ART_UTA_BBOX_Y0(bb), yf0), ART_UTILE_SIZE, - MAX(ART_UTA_BBOX_Y1(bb), (unsigned)yf1)); + MAX(ART_UTA_BBOX_Y1(bb), yf1)); uta->utiles[ix] = bb; xf0 = 0; ix++; @@ -138,9 +138,9 @@ bb = ART_UTA_BBOX_CONS(0, yf0, xf1, yf1); else bb = ART_UTA_BBOX_CONS(0, - MIN(ART_UTA_BBOX_Y0(bb), (unsigned)yf0), - MAX(ART_UTA_BBOX_X1(bb), (unsigned)xf1), - MAX(ART_UTA_BBOX_Y1(bb), (unsigned)yf1)); + MIN(ART_UTA_BBOX_Y0(bb), yf0), + MAX(ART_UTA_BBOX_X1(bb), xf1), + MAX(ART_UTA_BBOX_Y1(bb), yf1)); uta->utiles[ix] = bb; } else @@ -247,10 +247,10 @@ if (bb == 0) bb = ART_UTA_BBOX_CONS(xf0, yf0, xf1, yf1); else - bb = ART_UTA_BBOX_CONS(MIN(ART_UTA_BBOX_X0(bb), (unsigned)xf0), - MIN(ART_UTA_BBOX_Y0(bb), (unsigned)yf0), - MAX(ART_UTA_BBOX_X1(bb), (unsigned)xf1), - MAX(ART_UTA_BBOX_Y1(bb), (unsigned)yf1)); + bb = ART_UTA_BBOX_CONS(MIN(ART_UTA_BBOX_X0(bb), xf0), + MIN(ART_UTA_BBOX_Y0(bb), yf0), + MAX(ART_UTA_BBOX_X1(bb), xf1), + MAX(ART_UTA_BBOX_Y1(bb), yf1)); uta->utiles[ix] = bb; x = xn; @@ -258,8 +258,8 @@ ix += dix; } xmax = MAX(x, x1); - xmaxc = (int)ceil (xmax); - ymaxc = (int)ceil (y1); + xmaxc = ceil (xmax); + ymaxc = ceil (y1); xf0 = (int)floor (MIN(x1, x)) & (ART_UTILE_SIZE - 1); yf0 = (int)floor (y) & (ART_UTILE_SIZE - 1); xf1 = xmaxc - (xt0 << ART_UTILE_SHIFT); @@ -268,10 +268,10 @@ if (bb == 0) bb = ART_UTA_BBOX_CONS(xf0, yf0, xf1, yf1); else - bb = ART_UTA_BBOX_CONS(MIN(ART_UTA_BBOX_X0(bb), (unsigned)xf0), - MIN(ART_UTA_BBOX_Y0(bb), (unsigned)yf0), - MAX(ART_UTA_BBOX_X1(bb), (unsigned)xf1), - MAX(ART_UTA_BBOX_Y1(bb), (unsigned)yf1)); + bb = ART_UTA_BBOX_CONS(MIN(ART_UTA_BBOX_X0(bb), xf0), + MIN(ART_UTA_BBOX_Y0(bb), yf0), + MAX(ART_UTA_BBOX_X1(bb), xf1), + MAX(ART_UTA_BBOX_Y1(bb), yf1)); uta->utiles[ix] = bb; } } Index: rl_addons/renderPM/libart_lgpl/art_vpath_bpath.c =================================================================== --- rl_addons/renderPM/libart_lgpl/art_vpath_bpath.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/art_vpath_bpath.c (working copy) @@ -164,9 +164,19 @@ /* z3_0_dot is dist z0-z3 squared */ z3_0_dot = x3_0 * x3_0 + y3_0 * y3_0; - /* todo: this test is far from satisfactory. */ if (z3_0_dot < 0.001) - goto nosubdivide; + { + /* if start and end point are almost identical, the flatness tests + * don't work properly, so fall back on testing whether both of + * the other two control points are the same as the start point, + * too. + */ + if (hypot(x1 - x0, y1 - y0) < 0.001 + && hypot(x2 - x0, y2 - y0) < 0.001) + goto nosubdivide; + else + goto subdivide; + } /* we can avoid subdivision if: @@ -203,6 +213,7 @@ if (z2_dot + z2_dot > z3_0_dot) goto subdivide; + nosubdivide: /* don't subdivide */ art_vpath_add_point (p_vpath, pn, pn_max, Index: rl_addons/renderPM/libart_lgpl/ChangeLog =================================================================== --- rl_addons/renderPM/libart_lgpl/ChangeLog (revision 3457) +++ rl_addons/renderPM/libart_lgpl/ChangeLog (working copy) @@ -1,3 +1,176 @@ +2008-01-30 Alexander Larsson + + * configure.in: + * NEWS: + Release 2.3.20 + +2007-03-01 Frederic Crozat + + reviewed by: Dom Lachowicz + + * art_misc.h: Fix header when included in C++. + Patch from Goetz Waschk and Laurent Montel. + +2007-02-28 Kjartan Maraas + + configure.in: Release 2.3.19 + +2007-02-28 Kjartan Maraas + + * configure.in: Fix a typo introduced with the bug fix + for bug #131478. Noticed by Yanko Kaneti. + +2007-02-26 Kjartan Maraas + + * configure.in: 2.3.18. + +2006-12-06 Kjartan Maraas + + * .cvsignore: + * Makefile.am: + * autogen.sh: + * configure.in: + Port to automake 1.9. Patch from Christian Persch. + Closes bug #131478 + +2005-10-26 Alexander Larsson + + * Makefile.am: + * configure.in: + Cygwin build fixes from Cygwin Ports maintainer (#317562) + +2005-10-05 Dom Lachowicz + + * art-misc.[ch]: Turn memory-managing macros into proper functions + instead of preprocessor wrappers around malloc. Win32 ships multiple + runtimes, and an art_alloc'd block from one runtime can't be + art_free'd by a different runtime. + + * libart.def: Export the 3 new functions + +2005-05-27 Alexander Larsson + + * art_vpath_bpath.c: (art_vpath_render_bez): + Handle the case where start and endpoint are very near + in a better way. (#301750) + + Patch from Bernhard Herzog + +2005-03-24 Tor Lillqvist + + * art_misc.h (ART_GNUC_PRINTF, ART_GNUC_NORETURN): Use __format__, + __printf__ and __noreturn__ to avoid warnings in case "format", + "printf" or "noreturn" are #defined to something else. For example + GNU libintl.h (at least some versions of it) #defines printf as + libintl_printf. + +2005-01-24 Kjartan Maraas + + * art_render_gradient.c: (art_render_gradient_radial_render): + * testart.c: + * testuta.c: (main): Fix some compiler warnings etc. + +2005-01-21 Kjartan Maraas + + * Release 2.3.17 + +2004-03-22 Michael Meeks + + * Makefile.am (EXTRA_DIST): add libart.def. + +2004-03-04 Glynn Foster + + * Makefile.am, configure.in, libart-2.0-uninstalled.pc.in: + Add uninstalled pkg-config file. + +Tue Sep 09 16:30:31 2003 George Lebl + + * Release 2.3.16 + + * art_render_gradient.c: revert the double comparison test in the + asserts and comment out the two asserts causing crashes + everywhere, see bug #121850 + +2003-09-02 Alexander Larsson + + * configure.in: 2.3.15 + +2003-08-26 Morten Welinder + + * art_render_gradient.c (art_render_gradient_linear_render_8): Fix + vertical gradients. Fix yet more floating point comparisons using + !=. For the record, Gnumeric is a heavy user. + +2003-08-14 Tor Lillqvist + + Some nitpicking changes for Win32: + + * libart-features.h.in: Declare the variables from the library as + dlimport/dllexport on Win32. + + * Makefile.am: Don't use -lm on Win32. Use the libart.def file. + + * makefile.msc: Update to generate same name DLL and import + library as auto* and libtool. Add missing objects. (But dunno if + it is useful to maintain this file. It isn't distributed in the + source tarballs (should it be?). And, if it were distributed, and + the intention was to support random people really building libart + with MSVC, one should distribute also prebuilt config.h(.win32) + and libart-features.h(.win32) files.) + + * libart-zip.in (DEVZIP): Fix typo. + (DLLDIR): libtool 1.5 installs DLLs in $(prefix)/bin, so look + there, too. + + * libart.def: Add missing entry points. + + * testuta.c: To check that the export/import of the version + variables work, print out them in a comment. Undefine + LIBART_COMPILATION before including libart-features.h. + +2003-08-08 Alexander Larsson + + * configure.in: 2.3.14 + +Fri Jul 25 12:29:35 2003 George Lebl + + * art_render_gradient.c (art_render_gradient_linear_render_8) + (art_render_gradient_linear_render) (art_render_gradient_linear) + (art_render_gradient_radial_render) (art_render_gradient_radial): + Redo the checks where float was compared by == or != to using + the EPSILON define. Also copy the ArtGradientLinear and + ArtGradientRadial into the source structure, pretending that + these are constants that will never change or be freed by + the caller is utterly evil and in fact for librsvg it is + not constant. This fixes some more very random crashes + when using librsvg with libart (which seems to be the + only usage of the gradient stuff) + +Fri Jul 18 12:57:36 2003 George Lebl + + * art_render_gradient.c: Fix more comparison-of-doubles by == bugs, + this code is uber ugly. Should fix the fairly random crashes + on asserts I've been having. + +2003-07-11 Michael Meeks + + * Version 2.3.13 + +2003-07-11 Federico Mena Quintero + + * art_svp_ops.c (art_svp_minus): impl. + +Tue Jul 08 01:15:02 2003 George Lebl + + * art_render_gradient.c: fix comment as pointed out by alex + +Tue Jul 08 01:13:48 2003 George Lebl + + * art_render_gradient.c (art_render_gradient_linear_render_8): + when we wish to find the current segment and we go beyond the + last stop due to float fun, use the last segment as that's + really what we want. Avoids a very abrupt assert death. + 2003-05-05 Alexander Larsson * configure.in: Index: rl_addons/renderPM/libart_lgpl/configure.in =================================================================== --- rl_addons/renderPM/libart_lgpl/configure.in (revision 3457) +++ rl_addons/renderPM/libart_lgpl/configure.in (working copy) @@ -1,10 +1,18 @@ -AC_INIT(art_misc.h) -AM_CONFIG_HEADER(config.h) +m4_define([libart_major_version], [2]) +m4_define([libart_minor_version], [3]) +m4_define([libart_micro_version], [20]) +m4_define([libart_version], + [libart_major_version.libart_minor_version.libart_micro_version]) -LIBART_MAJOR_VERSION=2 -LIBART_MINOR_VERSION=3 -LIBART_MICRO_VERSION=12 -LIBART_VERSION=$LIBART_MAJOR_VERSION.$LIBART_MINOR_VERSION.$LIBART_MICRO_VERSION +AC_INIT([libart-lgpl],[libart_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=libart],[libart_lgpl]) + +AC_CONFIG_HEADERS([config.h]) + +LIBART_MAJOR_VERSION=libart_major_version +LIBART_MINOR_VERSION=libart_minor_version +LIBART_MICRO_VERSION=libart_micro_version +LIBART_VERSION=libart_version + LIBART_VERSION_INFO=`expr $LIBART_MAJOR_VERSION + $LIBART_MINOR_VERSION`:$LIBART_MICRO_VERSION:$LIBART_MINOR_VERSION AC_SUBST(LIBART_MAJOR_VERSION) @@ -13,10 +21,8 @@ AC_SUBST(LIBART_VERSION) AC_SUBST(LIBART_VERSION_INFO) -VERSION=$LIBART_VERSION +AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2]) -AM_INIT_AUTOMAKE(libart_lgpl, $VERSION) - AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]], , enable_ansi=no) @@ -27,8 +33,20 @@ AM_MAINTAINER_MODE -AC_MSG_CHECKING([for Win32]) +AC_MSG_CHECKING([for some Win32 platform]) case "$host" in + *-*-mingw*|*-*-cygwin*) + platform_win32=yes + ;; + *) + platform_win32=no + ;; +esac +AC_MSG_RESULT([$platform_win32]) +AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes") + +AC_MSG_CHECKING([for native Win32]) +case "$host" in *-*-mingw*) os_win32=yes ;; @@ -72,19 +90,15 @@ AC_FUNC_ALLOCA -LIBART_LIBDIR='-L${libdir}' -LIBART_INCLUDEDIR='-I${includedir}' -LIBART_LIBS='-lart_lgpl' - -AC_SUBST(LIBART_LIBDIR) -AC_SUBST(LIBART_INCLUDEDIR) -AC_SUBST(LIBART_LIBS) - AC_C_BIGENDIAN -AC_OUTPUT([ +AC_CONFIG_FILES([ libart-features.h Makefile -libart-config libart-2.0.pc -libart-zip], [case "$CONFIG_FILES" in *libart-config*) chmod +x libart-config;; esac]) +libart-2.0-uninstalled.pc +libart-zip]) + +AC_CONFIG_FILES([libart-config],[chmod +x libart-config]) + +AC_OUTPUT Index: rl_addons/renderPM/libart_lgpl/gen_art_config.c =================================================================== --- rl_addons/renderPM/libart_lgpl/gen_art_config.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/gen_art_config.c (working copy) @@ -29,7 +29,7 @@ "#define ART_SIZEOF_INT %d\n" "#define ART_SIZEOF_LONG %d\n" "\n", - sizeof(char), sizeof(short), sizeof(int), sizeof(long)); + (int)sizeof(char), (int)sizeof(short), (int)sizeof(int), (int)sizeof(long)); if (sizeof(char) == 1) printf ("typedef unsigned char art_u8;\n"); Index: rl_addons/renderPM/libart_lgpl/libart-features.h.in =================================================================== --- rl_addons/renderPM/libart_lgpl/libart-features.h.in (revision 3457) +++ rl_addons/renderPM/libart_lgpl/libart-features.h.in (working copy) @@ -6,9 +6,19 @@ #define LIBART_MICRO_VERSION (@LIBART_MICRO_VERSION@) #define LIBART_VERSION "@LIBART_VERSION@" -extern const unsigned int libart_major_version, libart_minor_version, libart_micro_version; -extern const char *libart_version; +#ifdef _WIN32 +# ifdef LIBART_COMPILATION +# define LIBART_VAR __declspec(dllexport) +# else +# define LIBART_VAR extern __declspec(dllimport) +# endif +#else +# define LIBART_VAR extern +#endif +LIBART_VAR const unsigned int libart_major_version, libart_minor_version, libart_micro_version; +LIBART_VAR const char *libart_version; + void libart_preinit(void *app, void *modinfo); void libart_postinit(void *app, void *modinfo); #endif Index: rl_addons/renderPM/libart_lgpl/Makefile.am =================================================================== --- rl_addons/renderPM/libart_lgpl/Makefile.am (revision 3457) +++ rl_addons/renderPM/libart_lgpl/Makefile.am (working copy) @@ -5,18 +5,24 @@ BUILT_SOURCES = art_config.h -art_config.h: gen_art_config +art_config.h: gen_art_config$(EXEEXT) ./gen_art_config > art_config.h EXTRA_DIST = \ + libart.def \ libart-config.in \ - libart-2.0.pc.in + libart-2.0.pc.in \ + libart-2.0-uninstalled.pc.in lib_LTLIBRARIES = libart_lgpl_2.la -if OS_WIN32 +if PLATFORM_WIN32 no_undefined = -no-undefined +endif +if OS_WIN32 +export_symbols = -export-symbols libart.def + install-libtool-import-lib: $(INSTALL) .libs/libart_lgpl_2.dll.a $(DESTDIR)$(libdir) uninstall-libtool-import-lib: @@ -24,6 +30,8 @@ else install-libtool-import-lib: uninstall-libtool-import-lib: + +libm = -lm endif if MS_LIB_AVAILABLE @@ -36,7 +44,7 @@ -rm $(DESTDIR)$(libdir)/art_lgpl_2.lib art_lgpl_2.lib : libart_lgpl_2.la - lib -name:libart_lgpl_2-@LIBART_MAJOR_VERSION@.dll -def:.libs/libart_lgpl_2-@LIBART_MAJOR_VERSION@.dll-def -out:$@ + lib -name:libart_lgpl_2-@LIBART_MAJOR_VERSION@.dll -def:libart.def -out:$@ else install-ms-lib: @@ -86,8 +94,8 @@ art_vpath_svp.c \ libart-features.c -libart_lgpl_2_la_LDFLAGS = -version-info @LIBART_VERSION_INFO@ $(no_undefined) -libart_lgpl_2_la_LIBADD = -lm +libart_lgpl_2_la_LDFLAGS = -version-info @LIBART_VERSION_INFO@ $(no_undefined) $(export_symbols) +libart_lgpl_2_la_LIBADD = $(libm) libart_lgplincdir = $(includedir)/libart-2.0/libart_lgpl libart_lgplinc_HEADERS = \ @@ -144,12 +152,12 @@ testart_SOURCES=testart.c testart_LDFLAGS = testart_DEPENDENCIES = $(DEPS) -testart_LDADD = $(LDADDS) -lm +testart_LDADD = $(LDADDS) $(libm) testuta_SOURCES=testuta.c testuta_LDFLAGS = testuta_DEPENDENCIES = $(DEPS) -testuta_LDADD = $(LDADDS) -lm +testuta_LDADD = $(LDADDS) $(libm) tests: testart testuta @@ -162,3 +170,6 @@ install-data-local: install-ms-lib install-libtool-import-lib uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib + +CLEANFILES = $(BUILT_SOURCES) $(bin_SCRIPTS) +DISTCLEANFILES = $(BUILT_SOURCES) $(bin_SCRIPTS) Index: rl_addons/renderPM/libart_lgpl/NEWS =================================================================== --- rl_addons/renderPM/libart_lgpl/NEWS (revision 3457) +++ rl_addons/renderPM/libart_lgpl/NEWS (working copy) @@ -1 +1,29 @@ -Please see http://www.levien.com/libart/ for the latest news. +============== +Version 2.3.20 +============== + +- Fix including art_misc.h from C++ + +============== +Version 2.3.19 +============== + +- Fix typo that broke versioning. (Yanko Kaneti) + +============== +Version 2.3.18 +============== + +- Port to automake 1.9 (Christian Persch) +- Cygwin build fixes (Cygwin ports maintainer) +- Fixes for memory management on win32 (Dom Lachowicz) +- Compiler warning fixes (Kjartan, Tor Lillqvist) + +============== +Version 2.3.17 +============== + +- Updated pkg-config files (Glynn Foster) +- Distribute libart.def (Michael Meeks) +- Add link to Mathieu's tutorial on libart (Kjartan) + Index: rl_addons/renderPM/libart_lgpl/README =================================================================== --- rl_addons/renderPM/libart_lgpl/README (revision 3457) +++ rl_addons/renderPM/libart_lgpl/README (working copy) @@ -13,3 +13,7 @@ For more information about libart, see the web page: http://www.levien.com/libart/ + +There's also a libart tutorial available at +http://www.gnome.org/~mathieu/libart/libart.html + Index: rl_addons/renderPM/libart_lgpl/testart.c =================================================================== --- rl_addons/renderPM/libart_lgpl/testart.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/testart.c (working copy) @@ -145,7 +145,7 @@ #endif #ifndef nDEAD_CODE -void +static void print_svp (ArtSVP *vp) { int i, j; @@ -515,6 +515,7 @@ fwrite (buf, 1, 512 * 512 * 3, stdout); } +#if 0 static void output_svp_ppm (const ArtSVP *svp) { @@ -524,6 +525,7 @@ printf ("P6\n512 512\n255\n"); fwrite (buf, 1, 512 * 512 * 3, stdout); } +#endif static void test_intersect (void) @@ -600,54 +602,6 @@ } static void -test_intersection(void) -{ - ArtVpath vp0[] = { - { ART_MOVETO, 10, 10}, - { ART_LINETO, 60, 60}, - { ART_LINETO, 110, 10}, - { ART_LINETO, 10, 10}, - { ART_END, 0, 0} - }, - vp1[]= { - {ART_MOVETO, 110,34.999999999999993}, - {ART_LINETO, 10,35}, - {ART_LINETO, 10,36}, - {ART_LINETO, 110,35.999999999999993}, - {ART_LINETO, 110,34.999999999999993}, - {ART_END, 0,0} - }, - vp2[]={ - {ART_MOVETO, 110,35.999999999999993}, - {ART_LINETO, 10,36}, - {ART_LINETO, 10,37}, - {ART_LINETO, 110,36.999999999999993}, - {ART_LINETO, 110,35.999999999999993}, - {ART_END, 0,0} - }, - *vp[] = {vp0, vp1, vp2}; - ArtSVP *svp[3], *svpi; - int i; - for(i=0;i<3;i++){ - svp[i]=art_svp_from_vpath(vp[i]); - printf("vpath[%d]\n", i); - print_vpath(vp[i]); - printf("svp[%d]\n", i); - print_svp(svp[i]); - } - for(i=2;i>0;i--){ - svpi = art_svp_intersect(svp[i],svp[0]); - printf("svp[%d] & svp[0]\n", i); - print_svp(svpi); - art_svp_free(svpi); - } - - for(i=0;i<3;i++){ - art_svp_free(svp[i]); - } -} - -static void usage (void) { fprintf (stderr, "usage: testart \n" @@ -656,8 +610,7 @@ " gradient -- test pattern for rendered gradients\n" " dash -- dash test (output is valid PostScript)\n" " dist -- distance test\n" -" intersect -- softball test for intersector\n" -" intersect1 -- intersection test\n"); +" intersect -- softball test for intersector\n"); exit (1); } @@ -677,8 +630,6 @@ test_dash (); else if (!strcmp (argv[1], "intersect")) test_intersect (); - else if (!strcmp (argv[1], "intersect1")) - test_intersection(); else usage (); return 0; Index: rl_addons/renderPM/libart_lgpl/testuta.c =================================================================== --- rl_addons/renderPM/libart_lgpl/testuta.c (revision 3457) +++ rl_addons/renderPM/libart_lgpl/testuta.c (working copy) @@ -28,6 +28,9 @@ #include "art_rect_uta.h" #include "art_uta_rect.h" +#undef LIBART_COMPILATION +#include "libart-features.h" + #define TEST_UTA #define noTEST_UTA_SPEED @@ -156,6 +159,8 @@ #ifdef TEST_UTA printf ("%%!PS-Adobe\n"); + printf ("%% libart version: %d.%d.%d\n", + libart_major_version, libart_minor_version, libart_micro_version); printf ("/Helvetica findfont 12 scalefont setfont\n"); printf ("0.5 setlinewidth\n"); @@ -180,7 +185,7 @@ uta = art_uta_from_irect (&bbox); } #endif - rbuf = 0; + rbuf = NULL; #else uta = art_uta_new_coords (0, 0, 500, 500);