summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-08-13 16:03:17 +0200
committerIvan Timofeev <timofeev.i.s@gmail.com>2012-08-13 19:02:47 +0400
commit93e819418070deb2750a918a1c3ea52376558d21 (patch)
tree8e7893a54465fd3e1967affc0e56635f1c0ad7dd /sw/source/core
parent1db8f09103403851baa193527eadd3a990be55c3 (diff)
fdo#53439 SwPageFrm::PaintBorderAndShadow fix painting at small zoom
Change-Id: I235895caaf95225148e61d96f4c3b14bf9f5542e (cherry picked from commit c5b9c197d70a0fb7d75bcedf2d70e6320175e846) Signed-off-by: Ivan Timofeev <timofeev.i.s@gmail.com>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/layout/paintfrm.cxx21
1 files changed, 16 insertions, 5 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ad81f20c0343..74936a192829 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5677,13 +5677,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));
@@ -5795,7 +5806,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
@@ -5807,15 +5818,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