added some comments
[swftools.git] / pdf2swf / swfoutput.cc
index 0bb93c9..b4cb4ce 100644 (file)
@@ -227,7 +227,7 @@ static int moveto(struct swfoutput*obj, TAG*tag, plotxy p0)
     }
     return 0;
 }
-static int moveto(struct swfoutput*obj, TAG*tag, float x, float y)
+static int moveto(struct swfoutput*obj, TAG*tag, double  x, double y)
 {
     swfoutput_internal*i = (swfoutput_internal*)obj->internal;
     plotxy p;
@@ -701,6 +701,12 @@ static int drawchar(struct swfoutput*obj, SWFFONT *swffont, char*character, int
                FIXNULL(character),charnr, u, FIXNULL((char*)swffont->name), swffont->numchars);
        return 0;
     }
+    /*if(swffont->glyph[charid].shape->bitlen <= 16) {
+       msg("<warning> Character '%s' (c=%d,u=%d), glyph %d in current charset (%s, %d characters) is empty", 
+               FIXNULL(character),charnr, u, charid, FIXNULL((char*)swffont->name), swffont->numchars);
+       return 0;
+    }*/
+
 
     if(i->shapeid>=0)
        endshape(obj);
@@ -2078,8 +2084,6 @@ gfxline_t* SVPtogfxline(ArtSVP*svp)
     }
 }
 
-
-
 static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int targetheight, int* newwidth, int* newheight)
 {
     RGBA*newpic = 0;
@@ -2130,32 +2134,19 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int
            /*newsizex, newsizey,*/
            num_colors>256?">":"", num_colors>256?256:num_colors);
 
-    if(has_alpha) {
-       if(num_colors<=256 || sizex<8 || sizey<8) {
-           i->tag = swf_InsertTag(i->tag,ST_DEFINEBITSLOSSLESS2);
-           swf_SetU16(i->tag, bitid);
-           swf_SetLosslessImage(i->tag,mem,sizex,sizey);
-       } else {
-           /*TODO: check what is smaller */
-           i->tag = swf_InsertTag(i->tag,ST_DEFINEBITSJPEG3);
-           swf_SetU16(i->tag, bitid);
-           swf_SetJPEGBits3(i->tag,sizex,sizey,mem,config_jpegquality);
-           //swf_SetLosslessImage(i->tag,mem,sizex,sizey);
-       }
-    } else {
-       if(num_colors<=256 || sizex<8 || sizey<8) {
-           i->tag = swf_InsertTag(i->tag,ST_DEFINEBITSLOSSLESS);
-           swf_SetU16(i->tag, bitid);
-           swf_SetLosslessImage(i->tag,mem,sizex,sizey);
-       } else {
-           /*TODO: check what is smaller */
-           i->tag = swf_InsertTag(i->tag,ST_DEFINEBITSJPEG2);
-           swf_SetU16(i->tag, bitid);
-           swf_SetJPEGBits2(i->tag,sizex,sizey,mem,config_jpegquality);
-           //swf_SetLosslessImage(i->tag,mem,sizex,sizey);
-       }
+    /*RGBA* pal = (RGBA*)rfx_alloc(sizeof(RGBA)*num_colors);
+    swf_ImageGetNumberOfPaletteEntries(mem,sizex,sizey,pal);
+    int t;
+    for(t=0;t<num_colors;t++) {
+       printf("%02x%02x%02x%02x ",
+               pal[t].r, pal[t].g, pal[t].b, pal[t].a);
+       if((t&7)==7)
+           printf("\n");
     }
-    
+    printf("\n");*/
+
+    i->tag = swf_AddImage(i->tag, bitid, mem, sizex, sizey, config_jpegquality);
+
     if(newpic)
        free(newpic);