*p++ = '-';
x = -x;
}
- if ((int)floor ((x + EPSILON / 2) < 1))
+ if (floor (x + EPSILON / 2) < 1)
{
*p++ = '0';
*p++ = '.';
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;
{
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;
}
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;
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;
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);
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;
struct _ArtImageSource {
ArtRenderCallback super;
void (*negotiate) (ArtImageSource *self, ArtRender *render,
- ArtImageSourceFlags *p_flags,
+ int *p_flags,
int *p_buf_depth, ArtAlphaType *p_alpha_type);
};
(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));
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++)
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 &&
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;
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;
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;
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;
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;
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;
}
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.
*/
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;
**/
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;
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;
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;
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)
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;
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;
}
/* 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;
}
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
/* 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,
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;
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++)
{
{
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;
}
/**
{
int i;
int size;
- ArtVpath *new;
+ ArtVpath *xnew;
double x, y;
double x_start, y_start;
int open;
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)
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;
}
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);
}
{
int n_segs = svp->n_segs;
ArtVpathSVPEnd *ends;
- ArtVpath *new;
+ ArtVpath *xnew;
int *visited;
int n_new, n_new_max;
int i, k;
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;
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;
{
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);
}
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);
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;
}
#include <stdarg.h>
#include <unistd.h>
#include <memory.h>
+#include <string.h>
+#include <math.h>
#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;
} internal_t;
static int verbose = 0;
+
static void dbg(char*format, ...)
{
if(!verbose)
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);
}
+#include "../../config.h"
+#include "../rfxswf.h"
+#include "../gfxdevice.h"
+#include "../gfxtools.h"
+#include "../art/libart.h"
#include <assert.h>
#include <math.h>
-static ArtVpath* gfxline_to_ArtVpath(gfxline_t*line)
+ArtVpath* gfxline_to_ArtVpath(gfxline_t*line)
{
ArtVpath *vec = NULL;
int pos=0,len=0;
return vec;
}
-static void show_path(ArtSVP*path)
+void show_path(ArtSVP*path)
{
int t;
printf("Segments: %d\n", path->n_segs);
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) {
}
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;
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);
return svp;
}
-static gfxline_t* SVPtogfxline(ArtSVP*svp)
+gfxline_t* SVPtogfxline(ArtSVP*svp)
{
int size = 0;
int t;
return 0;
}
}
-
}
}
-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;
}
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";
//#define ZSTEP (1/65536.0)
#define ZSTEP (1/32.0)
+//#define ZSTEP (1/4.0)
typedef struct _fontlist {
gfxfont_t*font;
#include "../mem.h"
#include "../gfxdevice.h"
#include "../gfxtools.h"
+#include "ops.h"
typedef struct _internal {
gfxdevice_t*out;
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;y<img->height;y++) {
gfxcolor_t*in = &img->data[y*img->width];
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);
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <memory.h>
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#include <string.h>
#include "../gfxdevice.h"
#include "../gfxtools.h"
#include "../types.h"
#include "../bitio.h"
+#include "record.h"
typedef struct _internal {
gfxfontlist_t* fontlist;
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 {
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;
}
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 {
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);
}
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;t<font->num_glyphs;t++) {
font->glyphs[t].line = readLine(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;
}
}
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);
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);
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);
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");
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")) {
#define PNG_INLINE_EXPORTS
#include "../types.h"
#include "../png.c"
+#include "render.h"
typedef gfxcolor_t RGBA;
{
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)
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;
{
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) {
*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)) {
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;
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 */
}
#include <string.h>
#include "../../config.h"
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#ifdef HAVE_ASSERT_H
#include <assert.h>
#else
#define assert(a)
#endif
#include <math.h>
+#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
swfoutput_internal*i = (swfoutput_internal*)dev->internal;
i->dev = dev;
- SRECT r;
RGBA rgb;
msg("<verbose> initializing swf output\n", i->max_x,i->max_y);
}
endpage(dev);
- fontlist_t *tmp,*iterator = i->fontlist;
+ fontlist_t *iterator = i->fontlist;
while(iterator) {
TAG*mtag = i->swf->firstTag;
if(iterator->swffont) {
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);
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);
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;
}
}
-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;
}
len += i->textpos;
j = j->next;
}
- char*text = malloc(len);
+ char*text = (char*)malloc(len);
int pos = 0;
j = i;
while(j) {
void preparequant(int quant);
void dct2(int*src, int*dest);
-int zigzagtable[64];
+extern int zigzagtable[64];
void zigzag(int*src);
#endif //__dct_h__