summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drv/cdcgm.c8
-rw-r--r--src/drv/cdpicture.c66
-rw-r--r--src/drv/cdps.c2
-rw-r--r--src/svg/cdsvg.c4
4 files changed, 73 insertions, 7 deletions
diff --git a/src/drv/cdcgm.c b/src/drv/cdcgm.c
index 94b1619..19f6ad7 100644
--- a/src/drv/cdcgm.c
+++ b/src/drv/cdcgm.c
@@ -567,10 +567,10 @@ static void cdpoly(cdCtxCanvas *ctxcanvas, int mode, cdPoint* poly, int n)
cgm_polygon( ctxcanvas->cgm, n, fpoly);
break;
case CD_BEZIER:
- cdfSimPolyBezier(ctxcanvas->canvas, fpoly, n);
+ cdfSimPolyBezier(ctxcanvas->canvas, (cdfPoint*)fpoly, n);
break;
case CD_PATH:
- cdfSimPolyPath(ctxcanvas->canvas, fpoly, n);
+ cdfSimPolyPath(ctxcanvas->canvas, (cdfPoint*)fpoly, n);
break;
}
@@ -602,10 +602,10 @@ static void cdfpoly(cdCtxCanvas *ctxcanvas, int mode, cdfPoint* poly, int n)
cgm_polygon( ctxcanvas->cgm, n, fpoly);
break;
case CD_BEZIER:
- cdfSimPolyBezier(ctxcanvas->canvas, fpoly, n);
+ cdfSimPolyBezier(ctxcanvas->canvas, poly, n);
break;
case CD_PATH:
- cdfSimPolyPath(ctxcanvas->canvas, fpoly, n);
+ cdfSimPolyPath(ctxcanvas->canvas, poly, n);
break;
}
}
diff --git a/src/drv/cdpicture.c b/src/drv/cdpicture.c
index 4cbc5d5..8cd586e 100644
--- a/src/drv/cdpicture.c
+++ b/src/drv/cdpicture.c
@@ -1243,6 +1243,72 @@ static int cdplay(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax, void
cdfCanvasVertex(canvas, prim->param.polyf.points[p].x, prim->param.polyf.points[p].y);
cdCanvasEnd(canvas);
break;
+ case CDPIC_PATH:
+ if (prim->param.path.fill)
+ primUpdateAttrib_Fill(prim, canvas);
+ else
+ primUpdateAttrib_Line(prim, canvas);
+ cdCanvasBegin(canvas, CD_PATH);
+ n = 0;
+ for (p=0; p<prim->param.path.path_n; p++)
+ {
+ cdCanvasPathSet(canvas, prim->param.path.path[p]);
+
+ switch(prim->param.path.path[p])
+ {
+ case CD_PATH_MOVETO:
+ case CD_PATH_LINETO:
+ if (n+1 > n) break;
+ cdCanvasVertex(canvas, prim->param.path.points[n].x, prim->param.path.points[n].y);
+ n++;
+ break;
+ case CD_PATH_CURVETO:
+ case CD_PATH_ARC:
+ {
+ if (n+3 > n) break;
+ cdCanvasVertex(canvas, prim->param.path.points[n].x, prim->param.path.points[n].y);
+ cdCanvasVertex(canvas, prim->param.path.points[n+1].x, prim->param.path.points[n+1].y);
+ cdCanvasVertex(canvas, prim->param.path.points[n+2].x, prim->param.path.points[n+2].y);
+ n += 3;
+ }
+ break;
+ }
+ }
+ cdCanvasEnd(canvas);
+ break;
+ case CDPIC_FPATH:
+ if (prim->param.path.fill)
+ primUpdateAttrib_Fill(prim, canvas);
+ else
+ primUpdateAttrib_Line(prim, canvas);
+ cdCanvasBegin(canvas, CD_PATH);
+ n = 0;
+ for (p=0; p<prim->param.pathf.path_n; p++)
+ {
+ cdCanvasPathSet(canvas, prim->param.pathf.path[p]);
+
+ switch(prim->param.pathf.path[p])
+ {
+ case CD_PATH_MOVETO:
+ case CD_PATH_LINETO:
+ if (n+1 > n) break;
+ cdfCanvasVertex(canvas, prim->param.pathf.points[n].x, prim->param.pathf.points[n].y);
+ n++;
+ break;
+ case CD_PATH_CURVETO:
+ case CD_PATH_ARC:
+ {
+ if (n+3 > n) break;
+ cdfCanvasVertex(canvas, prim->param.pathf.points[n].x, prim->param.pathf.points[n].y);
+ cdfCanvasVertex(canvas, prim->param.pathf.points[n+1].x, prim->param.pathf.points[n+1].y);
+ cdfCanvasVertex(canvas, prim->param.pathf.points[n+2].x, prim->param.pathf.points[n+2].y);
+ n += 3;
+ }
+ break;
+ }
+ }
+ cdCanvasEnd(canvas);
+ break;
case CDPIC_IMAGERGB:
cdCanvasPutImageRectRGB(canvas, prim->param.imagergba.iw, prim->param.imagergba.ih, prim->param.imagergba.r, prim->param.imagergba.g, prim->param.imagergba.b, prim->param.imagergba.x, prim->param.imagergba.y, prim->param.imagergba.w, prim->param.imagergba.h, 0, 0, 0, 0);
break;
diff --git a/src/drv/cdps.c b/src/drv/cdps.c
index 5c40103..abd061c 100644
--- a/src/drv/cdps.c
+++ b/src/drv/cdps.c
@@ -1893,7 +1893,7 @@ static cdAttribute rotate_attrib =
static void set_cmd_attrib(cdCtxCanvas *ctxcanvas, char* data)
{
- fprintf(ctxcanvas->file, data);
+ fprintf(ctxcanvas->file, "%s", data);
}
static cdAttribute cmd_attrib =
diff --git a/src/svg/cdsvg.c b/src/svg/cdsvg.c
index 677a91f..a1fdf8e 100644
--- a/src/svg/cdsvg.c
+++ b/src/svg/cdsvg.c
@@ -1196,7 +1196,7 @@ static void set_opacity_attrib(cdCtxCanvas *ctxcanvas, char* data)
static char* get_opacity_attrib(cdCtxCanvas *ctxcanvas)
{
static char data[50];
- sprintf(data, "%d", ctxcanvas->opacity);
+ sprintf(data, "%d", cdRound(ctxcanvas->opacity*255.0));
return data;
}
@@ -1209,7 +1209,7 @@ static cdAttribute opacity_attrib =
static void set_cmd_attrib(cdCtxCanvas *ctxcanvas, char* data)
{
- fprintf(ctxcanvas->file, data);
+ fprintf(ctxcanvas->file, "%s", data);
}
static cdAttribute cmd_attrib =