added focal gradient support
[swftools.git] / lib / modules / swfshape.c
index 6ef8aa2..5ac06f9 100644 (file)
@@ -418,8 +418,8 @@ int swf_ShapeSetLine(TAG * t,SHAPE * s,S32 x,S32 y)
     b = swf_CountBits(y,b);
     if (b<2) b=2;
     if(b >= 18) {
-        if(b >= 18 + 4) {
-            /* do not split into more than 16 segments. If the line is *that* long, something's broken */
+        if(b >= 18 + 6) {
+            /* do not split into more than 64 segments. If the line is *that* long, something's broken */
             fprintf(stderr, "Warning: Line to %.2f,%.2f is too long\n", (double)x,(double)y);
             return -1;
         } else {
@@ -543,15 +543,17 @@ static void parseFillStyleArray(TAG*tag, SHAPE2*shape)
                 else 
                     swf_GetRGB(tag, &dest->color);
             }
-            else if(type == 0x10 || type == 0x12)
+            else if(type == 0x10 || type == 0x11 || type == 0x12 || type == 0x13)
             {
                 /* linear/radial gradient fill */
                 swf_ResetReadBits(tag);
                 swf_GetMatrix(tag, &dest->m);
                 swf_ResetReadBits(tag);
                 swf_GetGradient(tag, &dest->gradient, num>=3?1:0);
+               if(type == 0x13)
+                   swf_GetU8(tag);
             }
-            else if(type == 0x40 || type == 0x41)
+            else if(type == 0x40 || type == 0x41 || type == 0x42 || type == 0x43)
             {
                 /* bitmap fill */
                 swf_ResetReadBits(tag);
@@ -749,17 +751,26 @@ SRECT swf_GetShapeBoundingBox(SHAPE2*shape2)
 void swf_Shape2Free(SHAPE2 * s)
 {
     SHAPELINE*line = s->lines;
+    s->lines = 0;
     while(line) {
        SHAPELINE*next = line->next;
+       line->next = 0;
        rfx_free(line);
        line = next;
     }
-    if(s->linestyles)
+
+    if(s->linestyles) {
        rfx_free(s->linestyles);
-    if(s->fillstyles)
+       s->linestyles = 0;
+    }
+    if(s->fillstyles) {
        rfx_free(s->fillstyles);
-    if(s->bbox)
+       s->fillstyles = 0;
+    }
+    if(s->bbox) {
        rfx_free(s->bbox);
+       s->bbox = 0;
+    }
 }
 
 SHAPE2* swf_Shape2Clone(SHAPE2 * s)