diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-08-13 16:03:17 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-08-13 16:05:08 +0200 |
commit | c5b9c197d70a0fb7d75bcedf2d70e6320175e846 (patch) | |
tree | 07e23655fc142bf6df1228d17f4faf060ae13862 | |
parent | 7fbab3fc351212cd8474159391bc744cee2d7e68 (diff) |
fdo#53439 SwPageFrm::PaintBorderAndShadow fix painting at small zoom
Change-Id: I235895caaf95225148e61d96f4c3b14bf9f5542e
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 477344b9502f..ba26ae14f07b 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 |