X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fpdf%2FBitmapOutputDev.cc;h=9e8123b10f4cb04c13a86f697dfee7a2eb4309ea;hp=49f5e3cda539b2178ac39a8eabae3a2fe4cbfc95;hb=0e7d4e61b7bcef123fd8212884bda5dbd3440316;hpb=bd6e5cd809f4fa605f8505fa06712981b3443537 diff --git a/lib/pdf/BitmapOutputDev.cc b/lib/pdf/BitmapOutputDev.cc index 49f5e3c..9e8123b 100644 --- a/lib/pdf/BitmapOutputDev.cc +++ b/lib/pdf/BitmapOutputDev.cc @@ -214,12 +214,26 @@ void BitmapOutputDev::flushBitmap() int ymax = b->ymax; /* clip against (-movex, -movey, -movex+width, -movey+height) */ - if(xmin < -this->movex) xmin = -this->movex; - if(ymin < -this->movey) ymin = -this->movey; - if(xmax > -this->movex + width) xmax = -this->movex+this->width; - if(ymax > -this->movey + height) ymax = -this->movey+this->height; - msg(" Flushing bitmap (bbox: %d,%d,%d,%d)", xmin,ymin,xmax,ymax); + msg(" Flushing bitmap (bbox: %d,%d,%d,%d %dx%d) (clipped against %d,%d,%d,%d)", xmin,ymin,xmax,ymax, xmax-xmin, ymax-ymin, + -this->movex, -this->movey, -this->movex+this->width, -this->movey+this->height); + + if(xmin < -this->movex) { + xmin = -this->movex; + if(xmax < -this->movex) continue; + } + if(ymin < -this->movey) { + ymin = -this->movey; + if(ymax < -this->movey) continue; + } + if(xmax >= -this->movex + this->width) { + xmax = -this->movex+this->width; + if(xmin >= -this->movex + this->width) continue; + } + if(ymax >= -this->movey + this->height) { + ymax = -this->movey+this->height; + if(ymin >= -this->movey + this->height) continue; + } if((xmax-xmin)<=0 || (ymax-ymin)<=0) // no bitmap, nothing to do continue; @@ -844,7 +858,6 @@ void BitmapOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, do this->width = (int)(x2-x1); this->height = (int)(y2-y1); - msg(" startPage"); rgbdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2); boolpolydev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2); booltextdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2); @@ -859,6 +872,8 @@ void BitmapOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, do booltextbitmap = booltextdev->getBitmap(); staletextbitmap = new SplashBitmap(booltextbitmap->getWidth(), booltextbitmap->getHeight(), 1, booltextbitmap->getMode(), 0); assert(staletextbitmap->getRowSize() == booltextbitmap->getRowSize()); + + msg(" startPage %dx%d (%dx%d)", this->width, this->height, booltextbitmap->getWidth(), booltextbitmap->getHeight()); clip0bitmap = clip0dev->getBitmap(); clip1bitmap = clip1dev->getBitmap(); @@ -1459,6 +1474,10 @@ void BitmapOutputDev::drawChar(GfxState *state, double x, double y, boolpolydev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen); booltextdev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen); clip1dev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen); + } else if(state->getRender()&RENDER_STROKE) { + // we're drawing as stroke + boolpolydev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen); + rgbdev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen); } else if(rgbbitmap != rgbdev->getBitmap()) { // we're doing softmasking or transparency grouping boolpolydev->drawChar(state, x, y, dx, dy, originX, originY, code, nBytes, u, uLen);