when rescaling images, don't omit an image if it's bitmap get's smaller
[swftools.git] / lib / devices / swf.c
index 67fd829..8ba141a 100644 (file)
@@ -1123,7 +1123,7 @@ static void endshape(gfxdevice_t*dev)
 
     changeRect(dev, i->tag, i->bboxrectpos, &i->bboxrect);
 
-    msg("<trace> Placing shape id %d", i->shapeid);
+    msg("<trace> Placing shape ID %d", i->shapeid);
 
     i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
     MATRIX m = i->page_matrix;
@@ -1661,6 +1661,7 @@ static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gf
        }
     }
     
+    msg("<trace> Placing link ID %d", buttonid);
     i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
 
     if(posx!=0 || posy!=0) {
@@ -1875,16 +1876,20 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int
 
     /// {
     if(is_jpeg && i->config_jpegsubpixels) {
-       newsizex = (int)(targetwidth*i->config_jpegsubpixels+0.5);
-       newsizey = (int)(targetheight*i->config_jpegsubpixels+0.5);
+       newsizex = (int)(targetwidth*i->config_jpegsubpixels + 0.5);
+       newsizey = (int)(targetheight*i->config_jpegsubpixels + 0.5);
     } else if(!is_jpeg && i->config_ppmsubpixels) {
-       newsizex = (int)(targetwidth*i->config_ppmsubpixels+0.5);
-       newsizey = (int)(targetheight*i->config_ppmsubpixels+0.5);
+       newsizex = (int)(targetwidth*i->config_ppmsubpixels + 0.5);
+       newsizey = (int)(targetheight*i->config_ppmsubpixels + 0.5);
     }
     /// }
 
-    if(sizex<=0 || sizey<=0 || newsizex<=0 || newsizey<=0)
+    if(sizex<=0 || sizey<=0)
        return -1;
+    if(newsizex<=0)
+       newsizex = 1;
+    if(newsizey<=0)
+       newsizey = 1;
 
     /* TODO: cache images */
     
@@ -2005,6 +2010,7 @@ static void swf_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxm
     swf_ShapeSetEnd(i->tag);
     swf_ShapeFree(shape);
 
+    msg("<trace> Placing bitmap ID %d", myshapeid);
     i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
     CXFORM cxform2 = gfxcxform_to_cxform(cxform);
     swf_ObjectPlace(i->tag,myshapeid,getNewDepth(dev),&i->page_matrix,&cxform2,NULL);
@@ -2049,6 +2055,7 @@ static void swf_startclip(gfxdevice_t*dev, gfxline_t*line)
 
     /* TODO: remember the bbox, and check all shapes against it */
     
+    msg("<trace> Placing clip ID %d", myshapeid);
     i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
     i->cliptags[i->clippos] = i->tag;
     i->clipshapes[i->clippos] = myshapeid;