X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswfshape.c;h=04cdf716d966f22be5ebc003c74826412d6e84b4;hb=89bf852c497d296477ac788f00a06b11e5502fa9;hp=183ef72b7198434c3a0067830ac531cf2dae49a9;hpb=d3f96573d464920ff5cde35e62a880bc8b54592f;p=swftools.git diff --git a/lib/modules/swfshape.c b/lib/modules/swfshape.c index 183ef72..04cdf71 100644 --- a/lib/modules/swfshape.c +++ b/lib/modules/swfshape.c @@ -416,7 +416,7 @@ int swf_ShapeSetLine(TAG * t,SHAPE * s,S32 x,S32 y) if(b >= 18) { if(b >= 18 + 4) { /* do not split into more than 16 segments. If the line is *that* long, something's broken */ - fprintf(stderr, "Warning: Line to %.2f,%.2f is too long", (double)x,(double)y); + fprintf(stderr, "Warning: Line to %.2f,%.2f is too long\n", (double)x,(double)y); return -1; } else { /* split line */ @@ -661,6 +661,35 @@ void swf_Shape2Free(SHAPE2 * s) rfx_free(s->bbox); } +SHAPE2* swf_Shape2Clone(SHAPE2 * s) +{ + SHAPELINE*line = s->lines; + SHAPELINE*prev = 0; + SHAPE2*s2 = rfx_alloc(sizeof(SHAPE2)); + memcpy(s2,s,sizeof(SHAPE2)); + s2->linestyles = rfx_alloc(sizeof(LINESTYLE)*s->numlinestyles); + memcpy(s2->linestyles, s->linestyles, sizeof(LINESTYLE)*s->numlinestyles); + s2->fillstyles = rfx_alloc(sizeof(FILLSTYLE)*s->numfillstyles); + memcpy(s2->fillstyles, s->fillstyles, sizeof(FILLSTYLE)*s->numfillstyles); + + while(line) { + SHAPELINE*line2 = rfx_alloc(sizeof(SHAPELINE)); + memcpy(line2, line, sizeof(SHAPELINE)); + line2->next = 0; + if(prev) + prev->next = line2; + else + s2->lines = line2; + prev = line2; + line = line->next; + } + if(s->bbox) { + s2->bbox = rfx_alloc(sizeof(SRECT)); + memcpy(s2->bbox, s->bbox, sizeof(SRECT)); + } + return s2; +} + SHAPE2* swf_ShapeToShape2(SHAPE*shape) { SHAPE2*shape2 = (SHAPE2*)rfx_calloc(sizeof(SHAPE2)); @@ -883,6 +912,7 @@ void swf_ParseDefineShape(TAG*tag, SHAPE2*shape) else { fprintf(stderr, "parseDefineShape must be called with a shape tag"); } + swf_SetTagPos(tag, 0); id = swf_GetU16(tag); //id memset(shape, 0, sizeof(SHAPE2));