replaced libart with new polygon code
[swftools.git] / lib / pdf / GFXOutputDev.cc
index 7bd0860..e963148 100644 (file)
@@ -791,6 +791,31 @@ void dump_outline(gfxline_t*line)
     }
 }
 
+void gfxPath_dump(GfxPath*path)
+{
+    int num = path->getNumSubpaths();
+    int t;
+    int cpos=0;
+    for(t = 0; t < num; t++) {
+       GfxSubpath *subpath = path->getSubpath(t);
+       int subnum = subpath->getNumPoints();
+        int s; 
+        for(s=0;s<subnum;s++) {
+          double x=subpath->getX(s);
+           double y=subpath->getY(s);
+          if(s==0 && !subpath->getCurve(s)) {
+                printf("M %f %f\n", x, y);
+           } else if(s==0 && subpath->getCurve(s)) {
+                printf("E %f %f\n", x, y);
+          } else if(subpath->getCurve(s)) {
+                printf("C %f %f\n", x, y);
+          } else {
+                printf("T %f %f\n", x, y);
+          }
+       }
+    }
+}
+
 gfxline_t* GFXOutputDev::gfxPath_to_gfxline(GfxState*state, GfxPath*path, int closed, int user_movex, int user_movey)
 {
     int num = path->getNumSubpaths();
@@ -1155,8 +1180,8 @@ void GFXOutputDev::strokeGfxline(GfxState *state, gfxline_t*line, int flags)
     }
 
     if(flags&STROKE_FILL) {
-        gfxpoly_t* poly = gfxpoly_strokeToPoly(line, width, capType, joinType, miterLimit);
-        gfxline_t*gfxline = gfxpoly_to_gfxline(poly);
+        gfxpoly_t* poly = gfxpoly_from_stroke(line, width, capType, joinType, miterLimit, DEFAULT_GRID);
+        gfxline_t*gfxline = gfxline_from_gfxpoly(poly);
        if(getLogLevel() >= LOGLEVEL_TRACE)  {
            dump_outline(gfxline);
        }
@@ -1170,7 +1195,7 @@ void GFXOutputDev::strokeGfxline(GfxState *state, gfxline_t*line, int flags)
             device->fill(device, gfxline, &col);
         }
         gfxline_free(gfxline);
-       gfxpoly_free(poly);
+       gfxpoly_destroy(poly);
     } else {
         if(flags&STROKE_CLIP) 
             msg("<error> Stroke&clip not supported at the same time");
@@ -1223,7 +1248,7 @@ void GFXOutputDev::clip(GfxState *state)
     msg("<trace> clip");
     gfxline_t*line = gfxPath_to_gfxline(state, path, 1, user_movex + clipmovex, user_movey + clipmovey);
     if(config_optimize_polygons) {
-       gfxline_t*line2 = gfxline_circularToEvenOdd(line);
+       gfxline_t*line2 = gfxpoly_circular_to_evenodd(line, DEFAULT_GRID);
        gfxline_free(line);
        line = line2;
     }
@@ -2444,7 +2469,7 @@ void GFXOutputDev::fill(GfxState *state)
     GfxPath * path = state->getPath();
     gfxline_t*line= gfxPath_to_gfxline(state, path, 1, user_movex + clipmovex, user_movey + clipmovey);
     if(config_optimize_polygons) {
-        gfxline_t*line2 = gfxline_circularToEvenOdd(line);
+        gfxline_t*line2 = gfxpoly_circular_to_evenodd(line, DEFAULT_GRID);
         gfxline_free(line);
         line = line2;
     }