From 0a162092f2e591374358ab802debe969936e9c86 Mon Sep 17 00:00:00 2001 From: kramm Date: Sun, 6 Nov 2005 22:57:50 +0000 Subject: [PATCH] small bugfix in drawchar(), removed rfxswf.h references --- pdf2swf/SWFOutputDev.cc | 51 ++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index ab19a5a..bf17212 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -1259,8 +1259,8 @@ void SWFOutputDev::drawChar(GfxState *state, double x, double y, } } - if(charid<0 && name) { - if(strcasecmp(name, "space")) { + if(charid<0) { + if(!name || strcasecmp(name, "space")) { msg(" Didn't find character '%s' (c=%d,u=%d) in current charset (%s, %d characters)", FIXNULL(name),c, u, FIXNULL((char*)current_font_id), current_gfxfont->num_glyphs); } @@ -2007,8 +2007,11 @@ int SWFOutputDev::setGfxFont(char*id, char*filename, double maxSize) we have to divide 0.05 by (fontsize/1024) */ double quality = (1024 * 0.05) / maxSize; - + + msg(" Loading %s...", filename); font = gfxfont_load(filename, quality); + msg(" Font %s loaded successfully", filename); + l = new fontlist_t; l->font = font; l->filename = strdup(filename); @@ -2103,7 +2106,7 @@ void SWFOutputDev::updateFont(GfxState *state) msg(" Font %s %scould not be loaded.", fontname, embedded?"":"(not embedded) "); if(lastfontdir) - msg(" Try putting a TTF version of that font (named \"%s.ttf\") into %s/swftools/fonts", fontname, lastfontdir); + msg(" Try putting a TTF version of that font (named \"%s.ttf\") into %s", fontname, lastfontdir); else msg(" Try specifying one or more font directories"); @@ -2132,6 +2135,8 @@ void SWFOutputDev::updateFont(GfxState *state) if(fileName) free(fileName); free(fontid); + + msg(" |"); } #define SQR(x) ((x)*(x)) @@ -2187,13 +2192,13 @@ unsigned char* antialize(unsigned char*data, int width, int height, int newwidth #define IMAGE_TYPE_JPEG 0 #define IMAGE_TYPE_LOSSLESS 1 -static void drawimage(gfxdevice_t*dev, RGBA* data, int sizex,int sizey, +static void drawimage(gfxdevice_t*dev, gfxcolor_t* data, int sizex,int sizey, double x1,double y1, double x2,double y2, double x3,double y3, double x4,double y4, int type) { - RGBA*newpic=0; + gfxcolor_t*newpic=0; double l1 = sqrt((x4-x1)*(x4-x1) + (y4-y1)*(y4-y1)); double l2 = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)); @@ -2238,13 +2243,13 @@ static void drawimage(gfxdevice_t*dev, RGBA* data, int sizex,int sizey, dev->fillbitmap(dev, &p1, &img, &m, 0); } -void drawimagejpeg(gfxdevice_t*dev, RGBA*mem, int sizex,int sizey, +void drawimagejpeg(gfxdevice_t*dev, gfxcolor_t*mem, int sizex,int sizey, double x1,double y1, double x2,double y2, double x3,double y3, double x4,double y4) { drawimage(dev,mem,sizex,sizey,x1,y1,x2,y2,x3,y3,x4,y4, IMAGE_TYPE_JPEG); } -void drawimagelossless(gfxdevice_t*dev, RGBA*mem, int sizex,int sizey, +void drawimagelossless(gfxdevice_t*dev, gfxcolor_t*mem, int sizex,int sizey, double x1,double y1, double x2,double y2, double x3,double y3, double x4,double y4) { drawimage(dev,mem,sizex,sizey,x1,y1,x2,y2,x3,y3,x4,y4, IMAGE_TYPE_LOSSLESS); @@ -2308,7 +2313,7 @@ void SWFOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str, unsigned char buf[8]; int x,y; unsigned char*pic = new unsigned char[width*height]; - RGBA pal[256]; + gfxcolor_t pal[256]; GfxRGB rgb; state->getFillRGB(&rgb); @@ -2359,14 +2364,14 @@ void SWFOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str, float r = 255/(numpalette-1); int t; for(t=0;tgetNumPixelComps()!=1 || str->getKind()==strDCT) { - RGBA*pic=new RGBA[width*height]; + gfxcolor_t*pic=new gfxcolor_t[width*height]; for (y = 0; y < height; ++y) { for (x = 0; x < width; ++x) { imgStr->getPixel(pixBuf); colorMap->getRGB(pixBuf, &rgb); - pic[width*y+x].r = (U8)(rgb.r * 255 + 0.5); - pic[width*y+x].g = (U8)(rgb.g * 255 + 0.5); - pic[width*y+x].b = (U8)(rgb.b * 255 + 0.5); + pic[width*y+x].r = (unsigned char)(rgb.r * 255 + 0.5); + pic[width*y+x].g = (unsigned char)(rgb.g * 255 + 0.5); + pic[width*y+x].b = (unsigned char)(rgb.b * 255 + 0.5); pic[width*y+x].a = 255;//(U8)(rgb.a * 255 + 0.5); } } @@ -2401,8 +2406,8 @@ void SWFOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str, delete imgStr; return; } else { - RGBA*pic=new RGBA[width*height]; - RGBA pal[256]; + gfxcolor_t*pic=new gfxcolor_t[width*height]; + gfxcolor_t pal[256]; int t; for(t=0;t<256;t++) { pixBuf[0] = t; @@ -2428,9 +2433,9 @@ void SWFOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str, pal[t].a = 0; } } else*/ { - pal[t].r = (U8)(rgb.r * 255 + 0.5); - pal[t].g = (U8)(rgb.g * 255 + 0.5); - pal[t].b = (U8)(rgb.b * 255 + 0.5); + pal[t].r = (unsigned char)(rgb.r * 255 + 0.5); + pal[t].g = (unsigned char)(rgb.g * 255 + 0.5); + pal[t].b = (unsigned char)(rgb.b * 255 + 0.5); pal[t].a = 255;//(U8)(rgb.b * 255 + 0.5); } } -- 1.7.10.4