[Libreoffice-commits] core.git: 2 commits - vcl/win

Tor Lillqvist tml at collabora.com
Thu Mar 10 09:08:14 UTC 2016


 vcl/win/gdi/winlayout.cxx |   32 ++++++--------------------------
 1 file changed, 6 insertions(+), 26 deletions(-)

New commits:
commit 7f25a5a0736c90a70d58fde6afaddd1ae4c24cb6
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Mar 10 10:11:58 2016 +0200

    Add comment wondering what the code thinks it is doing
    
    Change-Id: Icb135c12b2bc159e0542994bb496b45bf1fdb9e2

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 1b2ca79..691901e 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3770,6 +3770,7 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
     bool succeeded = GetDWriteInkBox(*pFontFace, rLayout, lfEmHeight, bounds);
     if (pRectToErase)
     {
+        // Isn't this equivalent to simply doing: bounds = *pRectToErase ?
         bounds.Intersection(*pRectToErase);
         bounds.Union(*pRectToErase);
     }
commit bda20c0f39acec27b39556fd7ee1cacfc2813720
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Mar 10 10:11:07 2016 +0200

    Factor out the calls to FillRect in the DrawTextImpl() implementations
    
    They were all in fact doing exactly the same, so do it at the call
    site instead.
    
    Change-Id: Id61cf9f5881411ddb7df5c3fd98c83252637e4d7

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 39d6fd7..1b2ca79 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -846,16 +846,10 @@ int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIds, Point& rPo
 }
 
 bool SimpleWinLayout::DrawTextImpl(HDC hDC,
-                                   const Rectangle* pRectToErase,
+                                   const Rectangle* /* pRectToErase */,
                                    Point* /* pPos */,
                                    int* /* pGetNextGlypInfo */) const
 {
-    if (pRectToErase)
-    {
-        RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), pRectToErase->Left()+pRectToErase->GetWidth(), pRectToErase->Top()+pRectToErase->GetHeight() };
-        FillRect(hDC, &aRect, static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
-    }
-
     if( mnGlyphCount <= 0 )
         return false;
 
@@ -1384,6 +1378,9 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
                 // we are making changes to the DC, make sure we got a new one
                 assert(aDC.getCompatibleHDC() != hDC);
 
+                RECT aWinRect = { aRect.Left(), aRect.Top(), aRect.Left() + aRect.GetWidth(), aRect.Top() + aRect.GetHeight() };
+                FillRect(aDC.getCompatibleHDC(), &aWinRect, static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
+
                 // setup the hidden DC with black color and white background, we will
                 // use the result of the text drawing later as a mask only
                 HFONT hOrigFont = SelectFont(aDC.getCompatibleHDC(), mhFont);
@@ -2605,16 +2602,10 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ )
 }
 
 bool UniscribeLayout::DrawTextImpl(HDC hDC,
-                                   const Rectangle* pRectToErase,
+                                   const Rectangle* /* pRectToErase */,
                                    Point* /* pPos */,
                                    int* /* pGetNextGlypInfo */) const
 {
-    if (pRectToErase)
-    {
-        RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), pRectToErase->Left()+pRectToErase->GetWidth(), pRectToErase->Top()+pRectToErase->GetHeight() };
-        FillRect(hDC, &aRect, static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
-    }
-
     HFONT hOrigFont = DisableFontScaling();
 
     int nBaseClusterOffset = 0;
@@ -3710,12 +3701,6 @@ bool ExTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
     const Rectangle* pRectToErase,
     Point* pPos, int* pGetNextGlypInfo)
 {
-    if (pRectToErase)
-    {
-        RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), pRectToErase->Left() + pRectToErase->GetWidth(), pRectToErase->Top() + pRectToErase->GetHeight() };
-        FillRect(hDC, &aRect, static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
-    }
-
     const int MAX_GLYPHS = 2;
     sal_GlyphId glyphIntStr[MAX_GLYPHS];
     int nGlyphs = 0;
@@ -3768,12 +3753,6 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
     const Rectangle* pRectToErase,
     Point* pPos, int* pGetNextGlypInfo)
 {
-    if (pRectToErase)
-    {
-        RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), pRectToErase->Left() + pRectToErase->GetWidth(), pRectToErase->Top() + pRectToErase->GetHeight() };
-        FillRect(hDC, &aRect, static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
-    }
-
     if (!Ready())
         return false;
 


More information about the Libreoffice-commits mailing list