[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sw/source

Jan Holesovsky kendy at kemper.freedesktop.org
Wed Aug 8 07:13:56 PDT 2012


 sw/source/core/layout/paintfrm.cxx |   22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

New commits:
commit e8b150131925d69786df4cf818484fa2b523131b
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Aug 8 10:13:53 2012 +0200

    n#773515 SwPageFrm::PaintBorderAndShadow fix shadow color on partial redraw
    
    How to reproduce: if you have a paragraph of text, and hit Enter in the
    middle of the paragraph, the frame around the document below the cursor
    position gets darker. Regression from
    f23d055dbee887ef9ebdf0a72b83ee1de91b7b8b.
    
    Change-Id: I41f9972b9be8d3ea02b52c0bc7355b012b41395d
    Signed-off-by: Jan Holesovsky <kendy at suse.cz>

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 4d874a1..ad81f20 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5677,6 +5677,20 @@ sal_Bool SwPageFrm::IsLeftShadowNeeded() const
     }
 }
 
+/// Wrapper around pOut->DrawBitmapEx.
+void lcl_paintBitmapExToRect(OutputDevice *pOut, Point aPoint, BitmapEx& rBitmapEx)
+{
+    // 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());
+    pOut->SetFillColor( SwViewOption::GetAppBackgroundColor());
+    pOut->SetLineColor();
+    pOut->DrawRect(pOut->PixelToLogic(aRect));
+
+    pOut->DrawBitmapEx(pOut->PixelToLogic(aPoint), rBitmapEx);
+}
+
 /** paint page border and shadow
 
     OD 12.02.2003 for #i9719# and #105645#
@@ -5781,7 +5795,7 @@ sal_Bool SwPageFrm::IsLeftShadowNeeded() const
             aPageTopRightShadow );
         BitmapEx aPageRightShadow = aPageRightShadowBase;
         aPageRightShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
-        pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() + mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1) ), aPageRightShadow );
+        lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Right() + mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1), aPageRightShadow );
     }
 
     // Left shadows and corners
@@ -5793,15 +5807,15 @@ sal_Bool SwPageFrm::IsLeftShadowNeeded() const
         pOut->DrawBitmapEx( pOut->PixelToLogic( Point( lLeft, aPagePxRect.Top() - mnShadowPxWidth ) ), aPageTopLeftShadow );
         BitmapEx aPageLeftShadow = aPageLeftShadowBase;
         aPageLeftShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
-        pOut->DrawBitmapEx( pOut->PixelToLogic( Point( lLeft, aPagePxRect.Top() + mnShadowPxWidth - 1) ), aPageLeftShadow );
+        lcl_paintBitmapExToRect(pOut, Point( lLeft, aPagePxRect.Top() + mnShadowPxWidth - 1), aPageLeftShadow);
     }
 
     BitmapEx aPageBottomShadow = aPageBottomShadowBase;
     aPageBottomShadow.Scale( aPaintRect.Width(), 1 );
-    pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left(), aPagePxRect.Bottom() + 1 ) ), aPageBottomShadow);
+    lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Left(), aPagePxRect.Bottom() + 1 ), aPageBottomShadow);
     BitmapEx aPageTopShadow = aPageTopShadowBase;
     aPageTopShadow.Scale( aPaintRect.Width(), 1 );
-    pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left(), aPagePxRect.Top() - mnShadowPxWidth ) ), aPageTopShadow );
+    lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Left(), aPagePxRect.Top() - mnShadowPxWidth ), aPageTopShadow );
 }
 
 //mod #i6193# paint sidebar for notes


More information about the Libreoffice-commits mailing list