From: Matthias Kramm <kramm@quiss.org>
Date: Thu, 8 Apr 2010 04:01:30 +0000 (-0700)
Subject: fixed bitmap overflow bug in poly2bitmap
X-Git-Tag: version-0-9-1~54
X-Git-Url: http://git.asbjorn.biz/?a=commitdiff_plain;h=4374572fb79cbe25bdd1498802605db5dfc908a6;p=swftools.git

fixed bitmap overflow bug in poly2bitmap
---

diff --git a/lib/pdf/BitmapOutputDev.cc b/lib/pdf/BitmapOutputDev.cc
index 49f5e3c..c9bcbb2 100644
--- a/lib/pdf/BitmapOutputDev.cc
+++ b/lib/pdf/BitmapOutputDev.cc
@@ -216,8 +216,8 @@ void BitmapOutputDev::flushBitmap()
 	/* 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;
+	if(xmax > -this->movex + this->width) xmax = -this->movex+this->width;
+	if(ymax > -this->movey + this->height) ymax = -this->movey+this->height;
 
 	msg("<verbose> Flushing bitmap (bbox: %d,%d,%d,%d)", xmin,ymin,xmax,ymax);
 	
@@ -844,7 +844,6 @@ void BitmapOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, do
     this->width = (int)(x2-x1);
     this->height = (int)(y2-y1);
 
-    msg("<debug> 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 +858,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("<debug> startPage %dx%d (%dx%d)", this->width, this->height, booltextbitmap->getWidth(), booltextbitmap->getHeight());
 
     clip0bitmap = clip0dev->getBitmap();
     clip1bitmap = clip1dev->getBitmap();