X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fpdf%2FBitmapOutputDev.cc;h=4f88282814f7aea8dda008e7af373b9b8f14ec43;hb=79722aa76968646601b00a472f5c715ae4287f29;hp=ac5744b7ec1559c96128437bdb5cb9669e401c7f;hpb=829935530fee5c47224f49c175ae1964119eb435;p=swftools.git diff --git a/lib/pdf/BitmapOutputDev.cc b/lib/pdf/BitmapOutputDev.cc index ac5744b..4f88282 100644 --- a/lib/pdf/BitmapOutputDev.cc +++ b/lib/pdf/BitmapOutputDev.cc @@ -417,13 +417,13 @@ GBool BitmapOutputDev::checkNewText(int x1, int y1, int x2, int y2) msg(" Testing new text data against current bitmap data, state=%s, counter=%d\n", STATE_NAME[layerstate], dbg_btm_counter); - char filename1[80]; - char filename2[80]; - char filename3[80]; - sprintf(filename1, "state%dboolbitmap_afternewtext.png", dbg_btm_counter); - sprintf(filename2, "state%dbooltext_afternewtext.png", dbg_btm_counter); - sprintf(filename3, "state%dbitmap_afternewtext.png", dbg_btm_counter); if(0) { + char filename1[80]; + char filename2[80]; + char filename3[80]; + sprintf(filename1, "state%dboolbitmap_afternewtext.png", dbg_btm_counter); + sprintf(filename2, "state%dbooltext_afternewtext.png", dbg_btm_counter); + sprintf(filename3, "state%dbitmap_afternewtext.png", dbg_btm_counter); msg(" %s %s %s", filename1, filename2, filename3); writeAlpha(boolpolybitmap, filename1); writeAlpha(booltextbitmap, filename2); @@ -476,14 +476,13 @@ GBool BitmapOutputDev::checkNewBitmap(int x1, int y1, int x2, int y2) /* similar to checkNewText() above, only in reverse */ msg(" Testing new graphics data against current text data, state=%s, counter=%d\n", STATE_NAME[layerstate], dbg_btm_counter); - char filename1[80]; - char filename2[80]; - char filename3[80]; - sprintf(filename1, "state%dboolbitmap_afternewgfx.png", dbg_btm_counter); - sprintf(filename2, "state%dbooltext_afternewgfx.png", dbg_btm_counter); - sprintf(filename3, "state%dbitmap_afternewgfx.png", dbg_btm_counter); - if(0) { + char filename1[80]; + char filename2[80]; + char filename3[80]; + sprintf(filename1, "state%dboolbitmap_afternewgfx.png", dbg_btm_counter); + sprintf(filename2, "state%dbooltext_afternewgfx.png", dbg_btm_counter); + sprintf(filename3, "state%dbitmap_afternewgfx.png", dbg_btm_counter); msg(" %s %s %s", filename1, filename2, filename3); writeAlpha(boolpolybitmap, filename1); writeAlpha(booltextbitmap, filename2); @@ -563,7 +562,7 @@ GBool BitmapOutputDev::clip0and1differ(int x1,int y1,int x2,int y2) int width8 = (width+7)/8; int height = clip0bitmap->getHeight(); - if(fixBBox(&x1,&y1,&x2,&y2,width,height)) { + if(!fixBBox(&x1,&y1,&x2,&y2,width,height)) { /* area is outside or null */ return gFalse; } @@ -576,9 +575,10 @@ GBool BitmapOutputDev::clip0and1differ(int x1,int y1,int x2,int y2) for(y=y1;ygetDataPtr()[width8*y+x18]; - unsigned char*row2 = &clip1bitmap->getDataPtr()[width8*y+x28]; - if(memcmp(row1, row2, x28-x18)) + unsigned char*row2 = &clip1bitmap->getDataPtr()[width8*y+x18]; + if(memcmp(row1, row2, x28-x18)) { return gTrue; + } } return gFalse; } else { @@ -1412,7 +1412,9 @@ void BitmapOutputDev::drawChar(GfxState *state, double x, double y, /* calculate the bbox of this character */ int x1 = (int)x, x2 = (int)x+1, y1 = (int)y, y2 = (int)y+1; - SplashPath*path = clip0dev->getCurrentFont()->getGlyphPath(code); + SplashFont*font = clip0dev->getCurrentFont(); + SplashPath*path = font?font->getGlyphPath(code):NULL; + if(!path) { if(code) msg(" couldn't create outline for char %d", code); @@ -1448,6 +1450,7 @@ void BitmapOutputDev::drawChar(GfxState *state, double x, double y, state->setRender(oldrender); } } else { + /* this char is not at all affected by clipping. Now just dump out the bitmap we're currently working on, if necessary. */ booltextdev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen);