fixed a wraparound bug for negative bitmap coordinates.
[swftools.git] / lib / modules / swfrender.c
index 062930a..11b0c50 100644 (file)
@@ -565,7 +565,7 @@ static void fill_bitmap(RGBA*line, int*z, int y, int x1, int x2, MATRIX*m, bitma
        return;
     }
     det = 20.0/det;
-    
+
     if(!b->width || !b->height) {
         fill_solid(line, z, y, x1, x2, color_red, depth);
         return;
@@ -586,6 +586,8 @@ static void fill_bitmap(RGBA*line, int*z, int y, int x1, int x2, MATRIX*m, bitma
            } else {
                xx %= b->width;
                yy %= b->height;
+               if(xx<0) xx += b->width;
+               if(yy<0) yy += b->height;
            }
 
            col = b->data[yy*b->width+xx];
@@ -1005,10 +1007,10 @@ static void textcallback(void*self, int*chars, int*xpos, int nr, int fontid, int
        } else {
            SHAPE2*shape = font->glyphs[chars[t]];
            shape->fillstyles[0].color = *color; //q&d
-           printf("Rendering char %d (size %d, x:%d, y:%d) color:%02x%02x%02x%02x\n", chars[t], fontsize, x, y,
+           /*printf("Rendering char %d (size %d, x:%d, y:%d) color:%02x%02x%02x%02x\n", chars[t], fontsize, x, y,
                    color->a, color->r, color->g, color->b);
            swf_DumpMatrix(stdout, &m);
-           swf_DumpShape(shape);
+           swf_DumpShape(shape);*/
            swf_RenderShape(info->buf, shape, &m, info->cxform, info->depth, info->clipdepth);
        }
     }