[Libreoffice-commits] .: sw/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Aug 13 07:05:02 PDT 2012


 sw/source/core/layout/paintfrm.cxx |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

New commits:
commit c5b9c197d70a0fb7d75bcedf2d70e6320175e846
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Aug 13 16:03:17 2012 +0200

    fdo#53439 SwPageFrm::PaintBorderAndShadow fix painting at small zoom
    
    Change-Id: I235895caaf95225148e61d96f4c3b14bf9f5542e

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 477344b..ba26ae1 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5666,13 +5666,24 @@ sal_Bool SwPageFrm::IsLeftShadowNeeded() const
     }
 }
 
+enum PaintArea {LEFT, RIGHT, TOP, BOTTOM};
+
 /// Wrapper around pOut->DrawBitmapEx.
-void lcl_paintBitmapExToRect(OutputDevice *pOut, Point aPoint, BitmapEx& rBitmapEx)
+void lcl_paintBitmapExToRect(OutputDevice *pOut, Point aPoint, BitmapEx& rBitmapEx, PaintArea eArea)
 {
     // The problem is that if we get called multiple times and the color is
     // partly transparent, then the result will get darker and darker. To avoid
     // this, always paint the background color before doing the real paint.
     Rectangle aRect(aPoint, rBitmapEx.GetSizePixel());
+
+    switch (eArea)
+    {
+        case LEFT: aRect.Left() = aRect.Right() - 1; break;
+        case RIGHT: aRect.Right() = aRect.Left() + 1; break;
+        case TOP: aRect.Top() = aRect.Bottom() - 1; break;
+        case BOTTOM: aRect.Bottom() = aRect.Top() + 1; break;
+    }
+
     pOut->SetFillColor( SwViewOption::GetAppBackgroundColor());
     pOut->SetLineColor();
     pOut->DrawRect(pOut->PixelToLogic(aRect));
@@ -5784,7 +5795,7 @@ void lcl_paintBitmapExToRect(OutputDevice *pOut, Point aPoint, BitmapEx& rBitmap
             aPageTopRightShadow );
         BitmapEx aPageRightShadow = aPageRightShadowBase;
         aPageRightShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
-        lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Right() + mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1), aPageRightShadow );
+        lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Right() + mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1), aPageRightShadow, RIGHT );
     }
 
     // Left shadows and corners
@@ -5796,15 +5807,15 @@ void lcl_paintBitmapExToRect(OutputDevice *pOut, Point aPoint, BitmapEx& rBitmap
         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);
+        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);
+    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 );
+    lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Left(), aPagePxRect.Top() - mnShadowPxWidth ), aPageTopShadow, TOP);
 }
 
 //mod #i6193# paint sidebar for notes


More information about the Libreoffice-commits mailing list