From f5fbd173ec19772ac0689d8644b90b36ec0a7daa Mon Sep 17 00:00:00 2001 From: kramm Date: Wed, 23 Feb 2005 20:47:46 +0000 Subject: [PATCH] * only scale images down * store ppm images alwyas as lossless * fixed libart include path --- pdf2swf/swfoutput.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index d73e3dc..38886c0 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -38,7 +38,7 @@ extern "C" { #include "../lib/gfxdevice.h" #include "../lib/gfxtools.h" } -#include "../lib/libart/libart.h" +#include "../lib/art/libart.h" #define CHARDATAMAX 8192 #define CHARMIDX 0 @@ -2042,10 +2042,6 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int } /// } - *newwidth = newsizex; - *newheight = newsizey; - - /* TODO: cache images */ msg(" Drawing %dx%d %s%simage at size %dx%d (%dx%d), %s%d colors", @@ -2057,15 +2053,15 @@ 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(newsizex!=sizex || newsizey!=sizey) { + if(newsizex>sizex || newsizey>sizey) { newpic = swf_ImageScale(mem, sizex, sizey, newsizex, newsizey); - sizex = newsizex; - sizey = newsizey; + *newwidth = sizex = newsizex; + *newheight = sizey = newsizey; mem = newpic; } if(has_alpha) { - if(num_colors<=256 || sizex<8 || sizey<8) { + if(!is_jpeg || 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); @@ -2077,7 +2073,7 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int //swf_SetLosslessImage(i->tag,mem,sizex,sizey); } } else { - if(num_colors<=256 || sizex<8) { + if(!is_jpeg || 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); -- 1.7.10.4