From b93de056e0b79f57c8f8fe22985b166c7d2c3dc3 Mon Sep 17 00:00:00 2001 From: kramm Date: Wed, 12 Dec 2007 09:36:42 +0000 Subject: [PATCH] applied MSVC compatibility patch from Dwight Kelly --- lib/art/art_affine.c | 4 +-- lib/art/art_bpath.c | 42 +++++++++++++++---------------- lib/art/art_pixbuf.c | 2 +- lib/art/art_render.c | 6 ++--- lib/art/art_render.h | 8 +++--- lib/art/art_render_gradient.c | 14 +++++------ lib/art/art_svp.c | 4 +-- lib/art/art_svp_intersect.c | 16 ++++++------ lib/art/art_svp_render_aa.c | 14 +++++------ lib/art/art_svp_vpath_stroke.c | 30 +++++++++++----------- lib/art/art_vpath.c | 30 +++++++++++----------- lib/art/art_vpath_svp.c | 20 +++++++-------- lib/devices/arts.c | 8 ++++-- lib/devices/artsutils.c | 18 ++++++++------ lib/devices/bbox.c | 2 +- lib/devices/file.c | 2 +- lib/devices/opengl.c | 1 + lib/devices/ops.c | 5 ++-- lib/devices/record.c | 54 +++++++++++++++++++++++++++++----------- lib/devices/render.c | 17 +++++++------ lib/devices/swf.c | 13 +++++----- lib/devices/text.c | 6 ++--- lib/h.263/dct.h | 2 +- 23 files changed, 175 insertions(+), 143 deletions(-) diff --git a/lib/art/art_affine.c b/lib/art/art_affine.c index 9f332a3..166ae9f 100644 --- a/lib/art/art_affine.c +++ b/lib/art/art_affine.c @@ -124,7 +124,7 @@ art_ftoa (char str[80], double x) *p++ = '-'; x = -x; } - if ((int)floor ((x + EPSILON / 2) < 1)) + if (floor (x + EPSILON / 2) < 1) { *p++ = '0'; *p++ = '.'; @@ -147,7 +147,7 @@ art_ftoa (char str[80], double x) x -= floor (x + EPSILON / 2); for (j = i; j < 6; j++) x *= 10; - ix = floor (x + 0.5); + ix = (int)floor (x + 0.5); for (j = 0; j < i; j++) ix *= 10; diff --git a/lib/art/art_bpath.c b/lib/art/art_bpath.c index a25acbf..d863c5c 100644 --- a/lib/art/art_bpath.c +++ b/lib/art/art_bpath.c @@ -43,50 +43,50 @@ art_bpath_affine_transform (const ArtBpath *src, const double matrix[6]) { int i; int size; - ArtBpath *new; + ArtBpath *xnew; ArtPathcode code; double x, y; for (i = 0; src[i].code != ART_END; i++); size = i; - new = art_new (ArtBpath, size + 1); + xnew = art_new (ArtBpath, size + 1); for (i = 0; i < size; i++) { code = src[i].code; - new[i].code = code; + xnew[i].code = code; if (code == ART_CURVETO) { x = src[i].x1; y = src[i].y1; - new[i].x1 = matrix[0] * x + matrix[2] * y + matrix[4]; - new[i].y1 = matrix[1] * x + matrix[3] * y + matrix[5]; + xnew[i].x1 = matrix[0] * x + matrix[2] * y + matrix[4]; + xnew[i].y1 = matrix[1] * x + matrix[3] * y + matrix[5]; x = src[i].x2; y = src[i].y2; - new[i].x2 = matrix[0] * x + matrix[2] * y + matrix[4]; - new[i].y2 = matrix[1] * x + matrix[3] * y + matrix[5]; + xnew[i].x2 = matrix[0] * x + matrix[2] * y + matrix[4]; + xnew[i].y2 = matrix[1] * x + matrix[3] * y + matrix[5]; } else { - new[i].x1 = 0; - new[i].y1 = 0; - new[i].x2 = 0; - new[i].y2 = 0; + xnew[i].x1 = 0; + xnew[i].y1 = 0; + xnew[i].x2 = 0; + xnew[i].y2 = 0; } x = src[i].x3; y = src[i].y3; - new[i].x3 = matrix[0] * x + matrix[2] * y + matrix[4]; - new[i].y3 = matrix[1] * x + matrix[3] * y + matrix[5]; + xnew[i].x3 = matrix[0] * x + matrix[2] * y + matrix[4]; + xnew[i].y3 = matrix[1] * x + matrix[3] * y + matrix[5]; } - new[i].code = ART_END; - new[i].x1 = 0; - new[i].y1 = 0; - new[i].x2 = 0; - new[i].y2 = 0; - new[i].x3 = 0; - new[i].y3 = 0; + xnew[i].code = ART_END; + xnew[i].x1 = 0; + xnew[i].y1 = 0; + xnew[i].x2 = 0; + xnew[i].y2 = 0; + xnew[i].x3 = 0; + xnew[i].y3 = 0; - return new; + return xnew; } diff --git a/lib/art/art_pixbuf.c b/lib/art/art_pixbuf.c index e993753..ea03783 100644 --- a/lib/art/art_pixbuf.c +++ b/lib/art/art_pixbuf.c @@ -272,7 +272,7 @@ art_pixbuf_duplicate (const ArtPixBuf *pixbuf) size = (pixbuf->height - 1) * pixbuf->rowstride + pixbuf->width * ((pixbuf->n_channels * pixbuf->bits_per_sample + 7) >> 3); - result->pixels = art_alloc (size); + result->pixels = (art_u8*)art_alloc (size); memcpy (result->pixels, pixbuf->pixels, size); result->width = pixbuf->width; diff --git a/lib/art/art_render.c b/lib/art/art_render.c index 65b344c..b3b1502 100644 --- a/lib/art/art_render.c +++ b/lib/art/art_render.c @@ -945,7 +945,7 @@ art_render_invoke (ArtRender *render) int i; int n_callbacks, n_callbacks_max; ArtImageSource *image_source; - ArtImageSourceFlags image_flags; + int image_flags; int buf_depth; ArtAlphaType buf_alpha; art_boolean first = ART_TRUE; @@ -1320,11 +1320,11 @@ art_render_image_solid_rgb8 (ArtRenderCallback *self, ArtRender *render, static void art_render_image_solid_negotiate (ArtImageSource *self, ArtRender *render, - ArtImageSourceFlags *p_flags, + int *p_flags, int *p_buf_depth, ArtAlphaType *p_alpha) { ArtImageSourceSolid *z = (ArtImageSourceSolid *)self; - ArtImageSourceFlags flags = 0; + int flags = 0; static void (*render_cbk) (ArtRenderCallback *self, ArtRender *render, art_u8 *dest, int y); diff --git a/lib/art/art_render.h b/lib/art/art_render.h index 744c816..dfb7ca2 100644 --- a/lib/art/art_render.h +++ b/lib/art/art_render.h @@ -74,10 +74,8 @@ typedef enum { ART_COMPOSITE_CUSTOM } ArtCompositingMode; -typedef enum { - ART_IMAGE_SOURCE_CAN_CLEAR = 1, - ART_IMAGE_SOURCE_CAN_COMPOSITE = 2 -} ArtImageSourceFlags; +#define ART_IMAGE_SOURCE_CAN_CLEAR 1 +#define ART_IMAGE_SOURCE_CAN_COMPOSITE 2 struct _ArtRenderMaskRun { int x; @@ -93,7 +91,7 @@ struct _ArtRenderCallback { struct _ArtImageSource { ArtRenderCallback super; void (*negotiate) (ArtImageSource *self, ArtRender *render, - ArtImageSourceFlags *p_flags, + int *p_flags, int *p_buf_depth, ArtAlphaType *p_alpha_type); }; diff --git a/lib/art/art_render_gradient.c b/lib/art/art_render_gradient.c index e58fff0..eea6262 100644 --- a/lib/art/art_render_gradient.c +++ b/lib/art/art_render_gradient.c @@ -249,7 +249,7 @@ art_render_gradient_linear_render_8 (ArtRenderCallback *self, (gradient->stops[n_stops-1].offset < (1.0 - EPSILON))) { extra_stops = 0; - tmp_stops = stops = alloca (sizeof (ArtGradientStop) * (n_stops + 2)); + tmp_stops = stops = (ArtGradientStop*)alloca (sizeof (ArtGradientStop) * (n_stops + 2)); if (gradient->stops[0].offset > EPSILON /* 0.0 */) { memcpy (tmp_stops, gradient->stops, sizeof (ArtGradientStop)); @@ -282,7 +282,7 @@ art_render_gradient_linear_render_8 (ArtRenderCallback *self, if (spread == ART_GRADIENT_REFLECT) { tmp_stops = stops; - stops = alloca (sizeof (ArtGradientStop) * n_stops * 2); + stops = (ArtGradientStop*)alloca (sizeof (ArtGradientStop) * n_stops * 2); memcpy (stops, tmp_stops, sizeof (ArtGradientStop) * n_stops); for (i = 0; i< n_stops; i++) @@ -561,7 +561,7 @@ art_render_gradient_linear_render (ArtRenderCallback *self, ArtRender *render, static void art_render_gradient_linear_negotiate (ArtImageSource *self, ArtRender *render, - ArtImageSourceFlags *p_flags, + int *p_flags, int *p_buf_depth, ArtAlphaType *p_alpha) { if (render->depth == 8 && @@ -593,7 +593,7 @@ art_render_gradient_linear (ArtRender *render, const ArtGradientLinear *gradient, ArtFilterLevel level) { - ArtImageSourceGradLin *image_source = art_alloc (sizeof (ArtImageSourceGradLin) + + ArtImageSourceGradLin *image_source = (ArtImageSourceGradLin*)art_alloc (sizeof (ArtImageSourceGradLin) + sizeof (ArtGradientStop) * (gradient->n_stops - 1)); image_source->super.super.render = NULL; @@ -630,7 +630,7 @@ art_render_gradient_radial_render (ArtRenderCallback *self, ArtRender *render, double fx = gradient->fx; double fy = gradient->fy; double dx, dy; - double *affine = gradient->affine; + double *affine = (double*)&gradient->affine[0]; double aff0 = affine[0]; double aff1 = affine[1]; const double a = z->a; @@ -673,7 +673,7 @@ art_render_gradient_radial_render (ArtRenderCallback *self, ArtRender *render, static void art_render_gradient_radial_negotiate (ArtImageSource *self, ArtRender *render, - ArtImageSourceFlags *p_flags, + int *p_flags, int *p_buf_depth, ArtAlphaType *p_alpha) { self->super.render = art_render_gradient_radial_render; @@ -695,7 +695,7 @@ art_render_gradient_radial (ArtRender *render, const ArtGradientRadial *gradient, ArtFilterLevel level) { - ArtImageSourceGradRad *image_source = art_alloc (sizeof (ArtImageSourceGradRad) + + ArtImageSourceGradRad *image_source = (ArtImageSourceGradRad*)art_alloc (sizeof (ArtImageSourceGradRad) + sizeof (ArtGradientStop) * (gradient->n_stops - 1)); double fx = gradient->fx; double fy = gradient->fy; diff --git a/lib/art/art_svp.c b/lib/art/art_svp.c index 8d7f7d1..a077e98 100644 --- a/lib/art/art_svp.c +++ b/lib/art/art_svp.c @@ -136,8 +136,8 @@ art_svp_free (ArtSVP *svp) int art_svp_seg_compare (const void *s1, const void *s2) { - const ArtSVPSeg *seg1 = s1; - const ArtSVPSeg *seg2 = s2; + const ArtSVPSeg *seg1 = (ArtSVPSeg *)s1; + const ArtSVPSeg *seg2 = (ArtSVPSeg *)s2; if (seg1->points[0].y - EPSILON > seg2->points[0].y) return 1; else if (seg1->points[0].y + EPSILON < seg2->points[0].y) return -1; diff --git a/lib/art/art_svp_intersect.c b/lib/art/art_svp_intersect.c index 30ce5c2..84d1da5 100644 --- a/lib/art/art_svp_intersect.c +++ b/lib/art/art_svp_intersect.c @@ -458,10 +458,10 @@ art_svp_writer_rewind_new (ArtWindRule rule) result->rule = rule; result->n_segs_max = 16; - result->svp = art_alloc (sizeof(ArtSVP) + + result->svp = (ArtSVP*)art_alloc (sizeof(ArtSVP) + (result->n_segs_max - 1) * sizeof(ArtSVPSeg)); result->svp->n_segs = 0; - result->n_points_max = art_new (int, result->n_segs_max); + result->n_points_max = (int*)art_new (int, result->n_segs_max); return &result->super; } @@ -650,10 +650,8 @@ art_svp_intersect_push_pt (ArtIntersectCtx *ctx, ArtActiveSeg *seg, art_pri_insert (ctx->pq, pri_pt); } -typedef enum { - ART_BREAK_LEFT = 1, - ART_BREAK_RIGHT = 2 -} ArtBreakFlags; +#define ART_BREAK_LEFT 1 +#define ART_BREAK_RIGHT 2 /** * art_svp_intersect_break: Break an active segment. @@ -665,7 +663,7 @@ typedef enum { */ static double art_svp_intersect_break (ArtIntersectCtx *ctx, ArtActiveSeg *seg, - double x_ref, double y, ArtBreakFlags break_flags) + double x_ref, double y, int break_flags) { double x0, y0, x1, y1; const ArtSVPSeg *in_seg = seg->in_seg; @@ -715,7 +713,7 @@ art_svp_intersect_break (ArtIntersectCtx *ctx, ArtActiveSeg *seg, **/ static ArtActiveSeg * art_svp_intersect_add_point (ArtIntersectCtx *ctx, double x, double y, - ArtActiveSeg *seg, ArtBreakFlags break_flags) + ArtActiveSeg *seg, int break_flags) { ArtActiveSeg *left, *right; double x_min = x, x_max = x; @@ -855,7 +853,7 @@ art_svp_intersect_swap_active (ArtIntersectCtx *ctx, static art_boolean art_svp_intersect_test_cross (ArtIntersectCtx *ctx, ArtActiveSeg *left_seg, ArtActiveSeg *right_seg, - ArtBreakFlags break_flags) + int break_flags) { double left_x0, left_y0, left_x1; double left_y1 = left_seg->y1; diff --git a/lib/art/art_svp_render_aa.c b/lib/art/art_svp_render_aa.c index d696a51..44ae90c 100644 --- a/lib/art/art_svp_render_aa.c +++ b/lib/art/art_svp_render_aa.c @@ -208,7 +208,7 @@ art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start, artfloat x_min, x_max; int ix_min, ix_max; artfloat delta; /* delta should be int too? */ - int last, this; + int last, xthis; int xdelta; artfloat rslope, drslope; int start; @@ -322,21 +322,21 @@ art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start, ix_max = x1; for (; x < ix_max; x++) { - this = (seg->dir ? 16711680.0 : -16711680.0) * rslope * + xthis = (seg->dir ? 16711680.0 : -16711680.0) * rslope * (x + 0.5 - x_min); - xdelta = this - last; - last = this; + xdelta = xthis - last; + last = xthis; ADD_STEP(x, xdelta) } if (x < x1) { - this = + xthis = delta * (1 - 0.5 * (x_max - ix_max) * (x_max - ix_max) * rslope); - xdelta = this - last; - last = this; + xdelta = xthis - last; + last = xthis; ADD_STEP(x, xdelta) diff --git a/lib/art/art_svp_vpath_stroke.c b/lib/art/art_svp_vpath_stroke.c index bf3111b..ce1487e 100644 --- a/lib/art/art_svp_vpath_stroke.c +++ b/lib/art/art_svp_vpath_stroke.c @@ -425,7 +425,7 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath, int n_result, n_result_max; double half_lw = 0.5 * line_width; int closed; - int last, this, next, second; + int last, xthis, next, second; double dx, dy; n_forw_max = 16; @@ -453,12 +453,12 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath, the opening pathcode), but why fix code that isn't broken? */ - this = begin_idx; + xthis = begin_idx; /* skip over identical points at the beginning of the subpath */ - for (i = this + 1; vpath[i].code == ART_LINETO; i++) + for (i = xthis + 1; vpath[i].code == ART_LINETO; i++) { - dx = vpath[i].x - vpath[this].x; - dy = vpath[i].y - vpath[this].y; + dx = vpath[i].x - vpath[xthis].x; + dy = vpath[i].y - vpath[xthis].y; if (dx * dx + dy * dy > EPSILON_2) break; } @@ -468,13 +468,13 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath, /* invariant: this doesn't coincide with next */ while (vpath[next].code == ART_LINETO) { - last = this; - this = next; + last = xthis; + xthis = next; /* skip over identical points after the beginning of the subpath */ - for (i = this + 1; vpath[i].code == ART_LINETO; i++) + for (i = xthis + 1; vpath[i].code == ART_LINETO; i++) { - dx = vpath[i].x - vpath[this].x; - dy = vpath[i].y - vpath[this].y; + dx = vpath[i].x - vpath[xthis].x; + dy = vpath[i].y - vpath[xthis].y; if (dx * dx + dy * dy > EPSILON_2) break; } @@ -486,15 +486,15 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath, semantics (i.e. explicit closepath code rather than just the fact that end of the path is the beginning) */ if (closed && - vpath[this].x == vpath[begin_idx].x && - vpath[this].y == vpath[begin_idx].y) + vpath[xthis].x == vpath[begin_idx].x && + vpath[xthis].y == vpath[begin_idx].y) { int j; /* path is closed, render join to beginning */ render_seg (&forw, &n_forw, &n_forw_max, &rev, &n_rev, &n_rev_max, - vpath, last, this, second, + vpath, last, xthis, second, join, half_lw, miter_limit, flatness); #ifdef VERBOSE @@ -526,7 +526,7 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath, /* add to forw rather than result to ensure that forw has at least one point. */ render_cap (&forw, &n_forw, &n_forw_max, - vpath, last, this, + vpath, last, xthis, cap, half_lw, flatness); art_vpath_add_point (&result, &n_result, &n_result_max, ART_MOVETO, forw[0].x, @@ -550,7 +550,7 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath, else render_seg (&forw, &n_forw, &n_forw_max, &rev, &n_rev, &n_rev_max, - vpath, last, this, next, + vpath, last, xthis, next, join, half_lw, miter_limit, flatness); } end_idx = next; diff --git a/lib/art/art_vpath.c b/lib/art/art_vpath.c index fa7b903..454ce99 100644 --- a/lib/art/art_vpath.c +++ b/lib/art/art_vpath.c @@ -81,7 +81,7 @@ art_vpath_new_circle (double x, double y, double r) ArtVpath *vec; double theta; - vec = art_new (ArtVpath, CIRCLE_STEPS + 2); + vec = (ArtVpath*)art_new (ArtVpath, CIRCLE_STEPS + 2); for (i = 0; i < CIRCLE_STEPS + 1; i++) { @@ -112,25 +112,25 @@ art_vpath_affine_transform (const ArtVpath *src, const double matrix[6]) { int i; int size; - ArtVpath *new; + ArtVpath *xnew; double x, y; for (i = 0; src[i].code != ART_END; i++); size = i; - new = art_new (ArtVpath, size + 1); + xnew = (ArtVpath*)art_new (ArtVpath, size + 1); for (i = 0; i < size; i++) { - new[i].code = src[i].code; + xnew[i].code = src[i].code; x = src[i].x; y = src[i].y; - new[i].x = matrix[0] * x + matrix[2] * y + matrix[4]; - new[i].y = matrix[1] * x + matrix[3] * y + matrix[5]; + xnew[i].x = matrix[0] * x + matrix[2] * y + matrix[4]; + xnew[i].y = matrix[1] * x + matrix[3] * y + matrix[5]; } - new[i].code = ART_END; + xnew[i].code = ART_END; - return new; + return xnew; } /** @@ -201,7 +201,7 @@ art_vpath_perturb (ArtVpath *src) { int i; int size; - ArtVpath *new; + ArtVpath *xnew; double x, y; double x_start, y_start; int open; @@ -209,14 +209,14 @@ art_vpath_perturb (ArtVpath *src) for (i = 0; src[i].code != ART_END; i++); size = i; - new = art_new (ArtVpath, size + 1); + xnew = (ArtVpath*)art_new (ArtVpath, size + 1); x_start = 0; y_start = 0; open = 0; for (i = 0; i < size; i++) { - new[i].code = src[i].code; + xnew[i].code = src[i].code; x = src[i].x + (PERTURBATION * rand ()) / RAND_MAX - PERTURBATION * 0.5; y = src[i].y + (PERTURBATION * rand ()) / RAND_MAX - PERTURBATION * 0.5; if (src[i].code == ART_MOVETO) @@ -232,10 +232,10 @@ art_vpath_perturb (ArtVpath *src) x = x_start; y = y_start; } - new[i].x = x; - new[i].y = y; + xnew[i].x = x; + xnew[i].y = y; } - new[i].code = ART_END; + xnew[i].code = ART_END; - return new; + return xnew; } diff --git a/lib/art/art_vpath_svp.c b/lib/art/art_vpath_svp.c index 000265c..2baed3c 100644 --- a/lib/art/art_vpath_svp.c +++ b/lib/art/art_vpath_svp.c @@ -51,8 +51,8 @@ art_vpath_svp_point_compare (double x1, double y1, double x2, double y2) static int art_vpath_svp_compare (const void *s1, const void *s2) { - const ArtVpathSVPEnd *e1 = s1; - const ArtVpathSVPEnd *e2 = s2; + const ArtVpathSVPEnd *e1 = (ArtVpathSVPEnd *)s1; + const ArtVpathSVPEnd *e2 = (ArtVpathSVPEnd *)s2; return art_vpath_svp_point_compare (e1->x, e1->y, e2->x, e2->y); } @@ -85,7 +85,7 @@ art_vpath_from_svp (const ArtSVP *svp) { int n_segs = svp->n_segs; ArtVpathSVPEnd *ends; - ArtVpath *new; + ArtVpath *xnew; int *visited; int n_new, n_new_max; int i, k; @@ -99,7 +99,7 @@ art_vpath_from_svp (const ArtSVP *svp) last_x = 0; /* to eliminate "uninitialized" warning */ last_y = 0; - ends = art_new (ArtVpathSVPEnd, n_segs * 2); + ends = (ArtVpathSVPEnd*)art_new (ArtVpathSVPEnd, n_segs * 2); for (i = 0; i < svp->n_segs; i++) { int lastpt; @@ -120,9 +120,9 @@ art_vpath_from_svp (const ArtSVP *svp) n_new = 0; n_new_max = 16; /* I suppose we _could_ estimate this from traversing the svp, so we don't have to reallocate */ - new = art_new (ArtVpath, n_new_max); + xnew = (ArtVpath*)art_new (ArtVpath, n_new_max); - visited = art_new (int, n_segs); + visited = (int*)art_new (int, n_segs); for (i = 0; i < n_segs; i++) visited[i] = 0; @@ -163,7 +163,7 @@ art_vpath_from_svp (const ArtSVP *svp) { if (first) { - art_vpath_add_point (&new, &n_new, &n_new_max, + art_vpath_add_point (&xnew, &n_new, &n_new_max, ART_MOVETO, svp->segs[seg_num].points[pt_num].x, svp->segs[seg_num].points[pt_num].y); @@ -171,7 +171,7 @@ art_vpath_from_svp (const ArtSVP *svp) } else { - art_vpath_add_point (&new, &n_new, &n_new_max, + art_vpath_add_point (&xnew, &n_new, &n_new_max, ART_LINETO, svp->segs[seg_num].points[pt_num].x, svp->segs[seg_num].points[pt_num].y); @@ -188,9 +188,9 @@ art_vpath_from_svp (const ArtSVP *svp) visited[seg_num] = 1; } - art_vpath_add_point (&new, &n_new, &n_new_max, + art_vpath_add_point (&xnew, &n_new, &n_new_max, ART_END, 0, 0); art_free (visited); art_free (ends); - return new; + return xnew; } diff --git a/lib/devices/arts.c b/lib/devices/arts.c index 34f38ce..baf5cf0 100644 --- a/lib/devices/arts.c +++ b/lib/devices/arts.c @@ -23,11 +23,14 @@ #include #include #include +#include +#include #include "../mem.h" #include "../gfxdevice.h" #include "../gfxtools.h" #include "../art/libart.h" -#include "artsutils.c" +#include "arts.h" +#include "artsutils.h" typedef struct _clip { ArtSVP*svp; @@ -41,6 +44,7 @@ typedef struct _internal { } internal_t; static int verbose = 0; + static void dbg(char*format, ...) { if(!verbose) @@ -336,6 +340,6 @@ void gfxdevice_union_init(gfxdevice_t*dev,gfxdevice_t*out) dev->finish = arts_finish; i->out = out; - i->svpunion = gfxstrokeToSVP(0, 0, 0, 0, 0); + i->svpunion = gfxstrokeToSVP(0, 0, gfx_capButt, gfx_joinMiter, 0); } diff --git a/lib/devices/artsutils.c b/lib/devices/artsutils.c index 2b375b8..0da39eb 100644 --- a/lib/devices/artsutils.c +++ b/lib/devices/artsutils.c @@ -1,7 +1,12 @@ +#include "../../config.h" +#include "../rfxswf.h" +#include "../gfxdevice.h" +#include "../gfxtools.h" +#include "../art/libart.h" #include #include -static ArtVpath* gfxline_to_ArtVpath(gfxline_t*line) +ArtVpath* gfxline_to_ArtVpath(gfxline_t*line) { ArtVpath *vec = NULL; int pos=0,len=0; @@ -143,7 +148,7 @@ static ArtVpath* gfxline_to_ArtVpath(gfxline_t*line) return vec; } -static void show_path(ArtSVP*path) +void show_path(ArtSVP*path) { int t; printf("Segments: %d\n", path->n_segs); @@ -161,7 +166,7 @@ static void show_path(ArtSVP*path) printf("\n"); } -static ArtSVP* gfxfillToSVP(gfxline_t*line, int perturb) +ArtSVP* gfxfillToSVP(gfxline_t*line, int perturb) { ArtVpath* vec = gfxline_to_ArtVpath(line); if(perturb) { @@ -235,7 +240,7 @@ static ArtSVP* gfxfillToSVP(gfxline_t*line, int perturb) } return svp; } -static ArtSVP* boxToSVP(double x1, double y1,double x2, double y2) +ArtSVP* boxToSVP(double x1, double y1,double x2, double y2) { ArtVpath *vec = art_new (ArtVpath, 5+1); vec[0].code = ART_MOVETO; @@ -261,7 +266,7 @@ static ArtSVP* boxToSVP(double x1, double y1,double x2, double y2) return svp; } -static ArtSVP* gfxstrokeToSVP(gfxline_t*line, gfxcoord_t width, gfx_capType cap_style, gfx_joinType joint_style, double miterLimit) +ArtSVP* gfxstrokeToSVP(gfxline_t*line, gfxcoord_t width, gfx_capType cap_style, gfx_joinType joint_style, double miterLimit) { ArtVpath* vec = gfxline_to_ArtVpath(line); @@ -280,7 +285,7 @@ static ArtSVP* gfxstrokeToSVP(gfxline_t*line, gfxcoord_t width, gfx_capType cap_ return svp; } -static gfxline_t* SVPtogfxline(ArtSVP*svp) +gfxline_t* SVPtogfxline(ArtSVP*svp) { int size = 0; int t; @@ -309,4 +314,3 @@ static gfxline_t* SVPtogfxline(ArtSVP*svp) return 0; } } - diff --git a/lib/devices/bbox.c b/lib/devices/bbox.c index 05df67f..5da181f 100644 --- a/lib/devices/bbox.c +++ b/lib/devices/bbox.c @@ -124,7 +124,7 @@ void bbox_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*colo } } -void bbox_drawlink(gfxdevice_t*dev, gfxline_t*line, char*action) +void bbox_drawlink(gfxdevice_t*dev, gfxline_t*line, const char*action) { internal_t*i = (internal_t*)dev->internal; } diff --git a/lib/devices/file.c b/lib/devices/file.c index e8cd973..70d1979 100644 --- a/lib/devices/file.c +++ b/lib/devices/file.c @@ -199,7 +199,7 @@ gfxresult_t* file_finish(struct _gfxdevice*dev) void gfxdevice_file_init(gfxdevice_t*dev, char*filename) { - internal_t*i = malloc(sizeof(internal_t)); + internal_t*i = (internal_t*)malloc(sizeof(internal_t)); memset(dev, 0, sizeof(gfxdevice_t)); dev->name = "file"; diff --git a/lib/devices/opengl.c b/lib/devices/opengl.c index 6b48c5e..c8efc05 100644 --- a/lib/devices/opengl.c +++ b/lib/devices/opengl.c @@ -17,6 +17,7 @@ //#define ZSTEP (1/65536.0) #define ZSTEP (1/32.0) +//#define ZSTEP (1/4.0) typedef struct _fontlist { gfxfont_t*font; diff --git a/lib/devices/ops.c b/lib/devices/ops.c index 911bc47..e5e19af 100644 --- a/lib/devices/ops.c +++ b/lib/devices/ops.c @@ -27,6 +27,7 @@ #include "../mem.h" #include "../gfxdevice.h" #include "../gfxtools.h" +#include "ops.h" typedef struct _internal { gfxdevice_t*out; @@ -110,7 +111,7 @@ void ops_fillbitmap(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxma gfximage_t img2; img2.width = img->width; img2.height = img->height; - img2.data = malloc(img->width*img->height*4); + img2.data = (gfxcolor_t*)malloc(img->width*img->height*4); int x,y; for(y=0;yheight;y++) { gfxcolor_t*in = &img->data[y*img->width]; @@ -142,7 +143,7 @@ void ops_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_t i->out->drawchar(i->out, font, glyphnr, color, matrix); } -void ops_drawlink(struct _gfxdevice*dev, gfxline_t*line, char*action) +void ops_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action) { internal_t*i = (internal_t*)dev->internal; i->out->drawlink(i->out, line, action); diff --git a/lib/devices/record.c b/lib/devices/record.c index ae5bedf..dce78bf 100644 --- a/lib/devices/record.c +++ b/lib/devices/record.c @@ -21,12 +21,19 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include +#ifdef HAVE_IO_H +#include +#endif +#include #include "../gfxdevice.h" #include "../gfxtools.h" #include "../types.h" #include "../bitio.h" +#include "record.h" typedef struct _internal { gfxfontlist_t* fontlist; @@ -95,7 +102,7 @@ static gfxline_t* readLine(reader_t*r) unsigned char op = reader_readU8(r); if(op == OP_END) break; - gfxline_t*line = rfx_calloc(sizeof(gfxline_t)); + gfxline_t*line = (gfxline_t*)rfx_calloc(sizeof(gfxline_t)); if(!start) { start = pos = line; } else { @@ -125,7 +132,7 @@ static gfximage_t readImage(reader_t*r) gfximage_t img; img.width = reader_readU16(r); img.height = reader_readU16(r); - img.data = rfx_alloc(img.width*img.height*4); + img.data = (gfxcolor_t*)rfx_alloc(img.width*img.height*4); r->read(r, img.data, img.width*img.height*4); return img; } @@ -156,7 +163,7 @@ static gfxgradient_t* readGradient(reader_t*r) U8 op = reader_readU8(r); if(!op) break; - gfxgradient_t*g = rfx_calloc(sizeof(gfxgradient_t)); + gfxgradient_t*g = (gfxgradient_t*)rfx_calloc(sizeof(gfxgradient_t)); if(!start) { start = pos = g; } else { @@ -173,7 +180,7 @@ static gfxcxform_t* readCXForm(reader_t*r) U8 type = reader_readU8(r); if(!type) return 0; - gfxcxform_t* c = rfx_calloc(sizeof(gfxcxform_t)); + gfxcxform_t* c = (gfxcxform_t*)rfx_calloc(sizeof(gfxcxform_t)); c->rr = reader_readFloat(r); c->rg = reader_readFloat(r); c->rb = reader_readFloat(r); c->ra = reader_readFloat(r); c->gr = reader_readFloat(r); c->gg = reader_readFloat(r); c->gb = reader_readFloat(r); c->ga = reader_readFloat(r); c->br = reader_readFloat(r); c->bg = reader_readFloat(r); c->bb = reader_readFloat(r); c->ba = reader_readFloat(r); @@ -247,12 +254,12 @@ static void dumpFont(writer_t*w, gfxfont_t*font) } static gfxfont_t*readFont(reader_t*r) { - gfxfont_t* font = rfx_calloc(sizeof(gfxfont_t)); + gfxfont_t* font = (gfxfont_t*)rfx_calloc(sizeof(gfxfont_t)); font->id = reader_readString(r); font->num_glyphs = reader_readU32(r); font->max_unicode = reader_readU32(r); - font->glyphs = rfx_calloc(sizeof(gfxglyph_t)*font->num_glyphs); - font->unicode2glyph = rfx_calloc(sizeof(font->unicode2glyph[0])*font->max_unicode); + font->glyphs = (gfxglyph_t*)rfx_calloc(sizeof(gfxglyph_t)*font->num_glyphs); + font->unicode2glyph = (int*)rfx_calloc(sizeof(font->unicode2glyph[0])*font->max_unicode); int t; for(t=0;tnum_glyphs;t++) { font->glyphs[t].line = readLine(r); @@ -260,7 +267,7 @@ static gfxfont_t*readFont(reader_t*r) font->glyphs[t].unicode = reader_readU32(r); font->glyphs[t].name = reader_readString(r); if(!font->glyphs[t].name[0]) { - free(font->glyphs[t].name); + free((void*)(font->glyphs[t].name)); font->glyphs[t].name = 0; } } @@ -361,7 +368,7 @@ static void record_endpage(struct _gfxdevice*dev) writer_writeU8(&i->w, OP_ENDPAGE); } -static void record_drawlink(struct _gfxdevice*dev, gfxline_t*line, char*action) +static void record_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action) { internal_t*i = (internal_t*)dev->internal; writer_writeU8(&i->w, OP_DRAWLINK); @@ -408,8 +415,20 @@ void gfxresult_record_replay(gfxresult_t*result, gfxdevice_t*device) double width = reader_readDouble(r); double miterlimit = reader_readDouble(r); gfxcolor_t color = readColor(r); - gfx_capType captype = reader_readU8(r); - gfx_joinType jointtype = reader_readU8(r); + gfx_capType captype; + int v = reader_readU8(r); + switch (v) { + case 0: captype = gfx_capButt; break; + case 1: captype = gfx_capRound; break; + case 2: captype = gfx_capSquare; break; + } + gfx_joinType jointtype; + v = reader_readU8(r); + switch (v) { + case 0: jointtype = gfx_joinMiter; break; + case 1: jointtype = gfx_joinRound; break; + case 2: jointtype = gfx_joinBevel; break; + } gfxline_t* line = readLine(r); device->stroke(device, line, width, &color, captype, jointtype,miterlimit); gfxline_free(line); @@ -443,7 +462,14 @@ void gfxresult_record_replay(gfxresult_t*result, gfxdevice_t*device) break; } case OP_FILLGRADIENT: { - gfxgradienttype_t type = reader_readU8(r); + gfxgradienttype_t type; + int v = reader_readU8(r); + switch (v) { + case 0: + type = gfxgradient_radial; break; + case 1: + type = gfxgradient_linear; break; + } gfxgradient_t*gradient = readGradient(r); gfxmatrix_t matrix = readMatrix(r); gfxline_t* line = readLine(r); @@ -483,7 +509,7 @@ static void record_result_write(gfxresult_t*r, int filedesc) internal_result_t*i = (internal_result_t*)r->internal; write(filedesc, i->data, i->length); } -static int record_result_save(gfxresult_t*r, char*filename) +static int record_result_save(gfxresult_t*r, const char*filename) { internal_result_t*i = (internal_result_t*)r->internal; FILE*fi = fopen(filename, "wb"); @@ -495,7 +521,7 @@ static int record_result_save(gfxresult_t*r, char*filename) fclose(fi); return 0; } -static void*record_result_get(gfxresult_t*r, char*name) +static void*record_result_get(gfxresult_t*r, const char*name) { internal_result_t*i = (internal_result_t*)r->internal; if(!strcmp(name, "data")) { diff --git a/lib/devices/render.c b/lib/devices/render.c index bb71bed..88b9ce9 100644 --- a/lib/devices/render.c +++ b/lib/devices/render.c @@ -28,6 +28,7 @@ #define PNG_INLINE_EXPORTS #include "../types.h" #include "../png.c" +#include "render.h" typedef gfxcolor_t RGBA; @@ -465,8 +466,8 @@ void newclip(struct _gfxdevice*dev) { internal_t*i = (internal_t*)dev->internal; - clipbuffer_t*c = rfx_calloc(sizeof(clipbuffer_t)); - c->data = rfx_calloc(sizeof(U32) * i->bitwidth * i->height2); + clipbuffer_t*c = (clipbuffer_t*)rfx_calloc(sizeof(clipbuffer_t)); + c->data = (U32*)rfx_calloc(sizeof(U32) * i->bitwidth * i->height2); c->next = i->clipbuf; i->clipbuf = c; if(c->next) @@ -510,14 +511,14 @@ void render_stroke(struct _gfxdevice*dev, gfxline_t*line, gfxcoord_t width, gfxc add_solidline(dev, x1, y1, x3, y3, width * i->multiply); fill_solid(dev, color); } else if(line->type == gfx_splineTo) { - int c,t,parts,qparts; + int t,parts,qparts; double xx,yy; double x1=x*i->zoom,y1=y*i->zoom; double x2=line->sx*i->zoom,y2=line->sy*i->zoom; double x3=line->x*i->zoom,y3=line->y*i->zoom; - c = abs(x3-2*x2+x1) + abs(y3-2*y2+y1); + double c = abs(x3-2*x2+x1) + abs(y3-2*y2+y1); xx=x1; yy=y1; @@ -669,7 +670,7 @@ void render_result_write(gfxresult_t*r, int filedesc) { internal_result_t*i= (internal_result_t*)r->internal; } -int render_result_save(gfxresult_t*r, char*filename) +int render_result_save(gfxresult_t*r, const char*filename) { internal_result_t*i= (internal_result_t*)r->internal; if(!i) { @@ -720,7 +721,7 @@ char*gfximage_asXPM(gfximage_t*img, int depth) *p = 0; return p; } -void*render_result_get(gfxresult_t*r, char*name) +void*render_result_get(gfxresult_t*r, const char*name) { internal_result_t*i= (internal_result_t*)r->internal; if(!strncmp(name,"xpm",3)) { @@ -814,7 +815,7 @@ void render_startpage(struct _gfxdevice*dev, int width, int height) static void store_image(internal_t*i, internal_result_t*ir) { - ir->img.data = malloc(i->width*i->height*sizeof(RGBA)); + ir->img.data = (gfxcolor_t*)malloc(i->width*i->height*sizeof(gfxcolor_t)); ir->img.width = i->width; ir->img.height = i->height; @@ -907,7 +908,7 @@ void render_endpage(struct _gfxdevice*dev) i->height2 = 0; } -void render_drawlink(struct _gfxdevice*dev, gfxline_t*line, char*action) +void render_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action) { /* not supported for this output device */ } diff --git a/lib/devices/swf.c b/lib/devices/swf.c index 872d0a9..2765d68 100644 --- a/lib/devices/swf.c +++ b/lib/devices/swf.c @@ -23,19 +23,23 @@ #include #include "../../config.h" #include +#ifdef HAVE_UNISTD_H #include +#endif #ifdef HAVE_ASSERT_H #include #else #define assert(a) #endif #include +#include "../mem.h" #include "../log.h" #include "../rfxswf.h" #include "../gfxdevice.h" #include "../gfxtools.h" #include "../art/libart.h" -#include "artsutils.c" +#include "swf.h" +#include "artsutils.h" #define CHARDATAMAX 8192 #define CHARMIDX 0 @@ -929,7 +933,6 @@ void gfxdevice_swf_init(gfxdevice_t* dev) swfoutput_internal*i = (swfoutput_internal*)dev->internal; i->dev = dev; - SRECT r; RGBA rgb; msg(" initializing swf output\n", i->max_x,i->max_y); @@ -1215,7 +1218,7 @@ void swfoutput_finalize(gfxdevice_t*dev) } endpage(dev); - fontlist_t *tmp,*iterator = i->fontlist; + fontlist_t *iterator = i->fontlist; while(iterator) { TAG*mtag = i->swf->firstTag; if(iterator->swffont) { @@ -1595,12 +1598,10 @@ static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gf SRECT r; int lsid=0; int fsid; - plotxy_t p1,p2,p3,p4; int myshapeid; int myshapeid2; double posx = 0; double posy = 0; - int t; int buttonid = getNewID(dev); gfxbbox_t bbox = gfxline_getbbox(points); @@ -2046,8 +2047,6 @@ static void swf_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxm double fy = (double)img->height / (double)newheight; MATRIX m; - float m00,m10,tx; - float m01,m11,ty; m.sx = (int)(65536*20*matrix->m00*fx); m.r1 = (int)(65536*20*matrix->m10*fy); m.r0 = (int)(65536*20*matrix->m01*fx); m.sy = (int)(65536*20*matrix->m11*fy); m.tx = (int)(matrix->tx*20); diff --git a/lib/devices/text.c b/lib/devices/text.c index 53f74d5..36c0e4f 100644 --- a/lib/devices/text.c +++ b/lib/devices/text.c @@ -60,7 +60,7 @@ void text_startpage(gfxdevice_t*dev, int width, int height) i->current_page = i->current_page->next; } i->current_page->textsize = 4096; - i->current_page->text = malloc(i->current_page->textsize); + i->current_page->text = (char*)malloc(i->current_page->textsize); i->current_page->textpos = 0; i->current_page->next = 0; i->currentx = 0; @@ -133,7 +133,7 @@ void text_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*colo } } -void text_drawlink(gfxdevice_t*dev, gfxline_t*line, char*action) +void text_drawlink(gfxdevice_t*dev, gfxline_t*line, const char*action) { internal_t*i = (internal_t*)dev->internal; } @@ -173,7 +173,7 @@ void*text_result_get(gfxresult_t*r, char*name) len += i->textpos; j = j->next; } - char*text = malloc(len); + char*text = (char*)malloc(len); int pos = 0; j = i; while(j) { diff --git a/lib/h.263/dct.h b/lib/h.263/dct.h index fb74703..eb71bd6 100644 --- a/lib/h.263/dct.h +++ b/lib/h.263/dct.h @@ -25,7 +25,7 @@ void idct(int*src); void preparequant(int quant); void dct2(int*src, int*dest); -int zigzagtable[64]; +extern int zigzagtable[64]; void zigzag(int*src); #endif //__dct_h__ -- 1.7.10.4