X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfxpoly%2Frenderpoly.c;h=c1a428f6c39d1546799f24e099e655e21a22d774;hp=9e3c593e9005b2308dbc383d928182c96a520725;hb=336f6de943b8c0bbeb0f64b7e35dd9511147a20a;hpb=64cbdc0d10e611af20d4d375ff6319793da8e6f5 diff --git a/lib/gfxpoly/renderpoly.c b/lib/gfxpoly/renderpoly.c index 9e3c593..c1a428f 100644 --- a/lib/gfxpoly/renderpoly.c +++ b/lib/gfxpoly/renderpoly.c @@ -120,7 +120,7 @@ static void fill_bitwise(unsigned char*line, int x1, int x2) } } -unsigned char* render_polygon(gfxpoly_t*polygon, intbbox_t*bbox, double zoom, windrule_t*rule) +unsigned char* render_polygon(gfxpoly_t*polygon, intbbox_t*bbox, double zoom, windrule_t*rule, windcontext_t*context) { renderbuf_t _buf, *buf=&_buf; buf->width = (bbox->xmax - bbox->xmin); @@ -128,6 +128,7 @@ unsigned char* render_polygon(gfxpoly_t*polygon, intbbox_t*bbox, double zoom, wi buf->bbox = *bbox; buf->zoom = zoom * polygon->gridsize; int width8 = (buf->width+7) >> 3; + char bleeding = 0; unsigned char* image = (unsigned char*)malloc(width8*buf->height); memset(image, 0, width8*buf->height); @@ -153,7 +154,7 @@ unsigned char* render_polygon(gfxpoly_t*polygon, intbbox_t*bbox, double zoom, wi qsort(points, num, sizeof(renderpoint_t), compare_renderpoints); int lastx = 0; - windstate_t fill = rule->start(1); + windstate_t fill = rule->start(context); for(n=0;nx - bbox->xmin); @@ -166,13 +167,15 @@ unsigned char* render_polygon(gfxpoly_t*polygon, intbbox_t*bbox, double zoom, wi if(fill.is_filled && lastxadd(fill, p->fs, p->dir, p->polygon_nr); + fill = rule->add(context, fill, p->fs, p->dir, p->polygon_nr); lastx = x; } if(fill.is_filled && lastx!=buf->width) { /* we're bleeding, fill over padding, too. */ fprintf(stderr, "Polygon %08x is bleeding in line %d\n", polygon, y); fill_bitwise(line, lastx, width8*8); + assert(line[width8-1]&0x01); + bleeding = 1; } } @@ -182,6 +185,9 @@ unsigned char* render_polygon(gfxpoly_t*polygon, intbbox_t*bbox, double zoom, wi } memset(&buf->lines[y], 0, sizeof(renderline_t)); } + if(bleeding) { + assert(!bitmap_ok(bbox, image)); + } free(buf->lines);buf->lines=0; return image; } @@ -192,6 +198,14 @@ unsigned char* render_polygon(gfxpoly_t*polygon, intbbox_t*bbox, double zoom, wi static inline max(double a, double b) {return a>b?a:b;} static inline min(double a, double b) {return a b.ymax) b.ymin = b.ymax; - - b.xmax += 8; - while(((b.xmax - b.xmin)&0x07) != 0x04) - b.xmax++; + + b.xmax = adjust_x(b.xmin, b.xmax); b.width = b.xmax - b.xmin; b.height = b.ymax - b.ymin; @@ -279,8 +292,6 @@ int bitmap_ok(intbbox_t*bbox, unsigned char*data) { int y; int width8 = (bbox->width+7) >> 3; - if((bbox->width&7) == 0) - return 1; for(y=0;yheight;y++) { if(data[width8-1]&0x01) return 0; //bleeding