[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2008-01-31 22:56:41
Message-ID: 1201820201.117683.31727.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 769259 by aacid:

Ensure we don't draw outside the main bitmap on SplashOutputDev::setSoftMask

BUG: 157000


 M  +6 -2      SplashOutputDev.cc  


--- branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf/SplashOutputDev.cc #769258:769259
@@ -2650,8 +2650,12 @@
   memset(softMask->getDataPtr(), 0,
 	 softMask->getRowSize() * softMask->getHeight());
   p = softMask->getDataPtr() + ty * softMask->getRowSize() + tx;
-  for (y = 0; y < tBitmap->getHeight(); ++y) {
-    for (x = 0; x < tBitmap->getWidth(); ++x) {
+  int xMax = tBitmap->getWidth();
+  int yMax = tBitmap->getHeight();
+  if (xMax + tx > bitmap->getWidth()) xMax = bitmap->getWidth() - tx;
+  if (yMax + ty > bitmap->getHeight()) yMax = bitmap->getHeight() - ty;
+  for (y = 0; y < yMax; ++y) {
+    for (x = 0; x < xMax; ++x) {
       tBitmap->getPixel(x, y, color);
       if (alpha) {
 	//~ unimplemented
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic