[Libreoffice-commits] .: sw/source vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 20 01:33:17 PST 2012


 sw/source/core/layout/paintfrm.cxx |   28 ++++++++++++++++++++--------
 vcl/source/gdi/bitmap3.cxx         |    4 ++++
 2 files changed, 24 insertions(+), 8 deletions(-)

New commits:
commit 9b3d96fddd214b808f241197c42af0434c6bba82
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Nov 20 09:32:54 2012 +0000

    fdo#57059 - fix crasher rendering borders for very small windows.

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index fc50baf..717a253 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5791,9 +5791,15 @@ static void lcl_paintBitmapExToRect(OutputDevice *pOut, Point aPoint, BitmapEx&
             aPageBottomRightShadow );
         pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() + 1, aPagePxRect.Top() - mnShadowPxWidth ) ),
             aPageTopRightShadow );
-        BitmapEx aPageRightShadow = aPageRightShadowBase;
-        aPageRightShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
-        lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Right() + mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1), aPageRightShadow, RIGHT );
+
+        if ( aPagePxRect.Height() > 2 * mnShadowPxWidth)
+        {
+            BitmapEx aPageRightShadow = aPageRightShadowBase;
+            aPageRightShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
+            lcl_paintBitmapExToRect( pOut, Point( aPaintRect.Right() + mnShadowPxWidth,
+                                                 aPagePxRect.Top() + mnShadowPxWidth - 1),
+                                     aPageRightShadow, RIGHT );
+        }
     }
 
     // Left shadows and corners
@@ -5803,17 +5809,23 @@ static void lcl_paintBitmapExToRect(OutputDevice *pOut, Point aPoint, BitmapEx&
         pOut->DrawBitmapEx( pOut->PixelToLogic( Point( lLeft,
             aPagePxRect.Bottom() + 1 + mnShadowPxWidth - aPageBottomLeftShadow.GetSizePixel().Height() ) ), aPageBottomLeftShadow );
         pOut->DrawBitmapEx( pOut->PixelToLogic( Point( lLeft, aPagePxRect.Top() - mnShadowPxWidth ) ), aPageTopLeftShadow );
-        BitmapEx aPageLeftShadow = aPageLeftShadowBase;
-        aPageLeftShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
-        lcl_paintBitmapExToRect(pOut, Point( lLeft, aPagePxRect.Top() + mnShadowPxWidth - 1), aPageLeftShadow, LEFT);
+        if ( aPagePxRect.Height() > 2 * mnShadowPxWidth)
+        {
+            BitmapEx aPageLeftShadow = aPageLeftShadowBase;
+            aPageLeftShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
+            lcl_paintBitmapExToRect( pOut, Point( lLeft, aPagePxRect.Top() + mnShadowPxWidth - 1),
+                                     aPageLeftShadow, LEFT );
+        }
     }
 
     BitmapEx aPageBottomShadow = aPageBottomShadowBase;
     aPageBottomShadow.Scale( aPaintRect.Width(), 1 );
-    lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Left(), aPagePxRect.Bottom() + 1 ), aPageBottomShadow, BOTTOM);
+    lcl_paintBitmapExToRect( pOut, Point( aPaintRect.Left(), aPagePxRect.Bottom() + 1 ),
+                             aPageBottomShadow, BOTTOM );
     BitmapEx aPageTopShadow = aPageTopShadowBase;
     aPageTopShadow.Scale( aPaintRect.Width(), 1 );
-    lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Left(), aPagePxRect.Top() - mnShadowPxWidth ), aPageTopShadow, TOP);
+    lcl_paintBitmapExToRect( pOut, Point( aPaintRect.Left(), aPagePxRect.Top() - mnShadowPxWidth ),
+                             aPageTopShadow, TOP );
 }
 
 //mod #i6193# paint sidebar for notes
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 0031fa0..fab9d90 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -2175,6 +2175,10 @@ bool Bitmap::ImplScaleConvolution( const double& rScaleX, const double& rScaleY,
     int* pPixels;
     int* pCount;
 
+    // Handle negative scales safely cf. other ImplScale methods
+    if( ( nNewWidth < 1L ) || ( nNewHeight < 1L ) )
+        return false;
+
     // Do horizontal filtering
     ImplCalculateContributions( nWidth, nNewWidth, aNumberOfContributions, pWeights, pPixels, pCount, aKernel );
     pReadAcc = AcquireReadAccess();


More information about the Libreoffice-commits mailing list