X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fpdf%2FBitmapOutputDev.cc;h=320fc3ff3937a7f836fcbb28f171c133c5eaa9c1;hp=c9bcbb2686ea3ad984f9d5033a7d11217f780a31;hb=52cd86c5fb2bcf5a31b2e34a6efae34a81d59642;hpb=4374572fb79cbe25bdd1498802605db5dfc908a6 diff --git a/lib/pdf/BitmapOutputDev.cc b/lib/pdf/BitmapOutputDev.cc index c9bcbb2..320fc3f 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 + this->width) xmax = -this->movex+this->width; - if(ymax > -this->movey + this->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;