vcl/inc/win/winlayout.hxx |   12 +++---------
 vcl/win/gdi/winlayout.cxx |   38 ++++++++++++++++----------------------
 2 files changed, 19 insertions(+), 31 deletions(-)

New commits:
commit 29d2f85e198d5b844d5a10562723a65173cf22ea
Author: Caolán McNamara <caol...@redhat.com>
Date:   Sun Mar 5 21:35:23 2017 +0000

    Restore "pPos and pGetNextGlypInfo always have the same value"
    
    and...
    
    "pEraseRect is always null"
    
    This reverts commit b398dacbb471913e573e9b0b4cd31d94a9109223.
    
    Change-Id: I5e7c07eefff0b6bd39d9ed7492134ea062e90fdf
    Reviewed-on: https://gerrit.libreoffice.org/34907
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledho...@eglug.org>

diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index 42b25b6..bc1890b 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -179,9 +179,7 @@ public:
 
     virtual bool operator ()(CommonSalLayout const &rLayout,
         SalGraphics &rGraphics,
-        HDC hDC,
-        const Rectangle* pRectToErase,
-        Point* pPos, int* pGetNextGlypInfo) = 0;
+        HDC hDC) = 0;
 };
 
 class ExTextOutRenderer : public TextOutRenderer
@@ -194,9 +192,7 @@ public:
 
     bool operator ()(CommonSalLayout const &rLayout,
         SalGraphics &rGraphics,
-        HDC hDC,
-        const Rectangle* pRectToErase,
-        Point* pPos, int* pGetNextGlypInfo) override;
+        HDC hDC) override;
 };
 
 class D2DWriteTextOutRenderer : public TextOutRenderer
@@ -219,9 +215,7 @@ public:
 
     bool operator ()(CommonSalLayout const &rLayout,
         SalGraphics &rGraphics,
-        HDC hDC,
-        const Rectangle* pRectToErase,
-        Point* pPos, int* pGetNextGlypInfo) override;
+        HDC hDC) override;
 
     inline bool BindDC(HDC hDC, Rectangle const & rRect = Rectangle(0, 0, 0, 
0)) {
         RECT const rc = { rRect.Left(), rRect.Top(), rRect.Right(), 
rRect.Bottom() };
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index c884c9e..a8d71fc 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -264,12 +264,8 @@ TextOutRenderer & TextOutRenderer::get(bool bUseDWrite)
 
 bool ExTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
     SalGraphics & /*rGraphics*/,
-    HDC hDC,
-    const Rectangle* pRectToErase,
-    Point* pPos, int* pGetNextGlypInfo)
+    HDC hDC)
 {
-    bool bGlyphs = false;
-    const GlyphItem* pGlyph;
     HFONT hFont = static_cast<HFONT>(GetCurrentObject( hDC, OBJ_FONT ));
     HFONT hAltFont = nullptr;
     bool bUseAltFont = false;
@@ -284,16 +280,19 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const 
&rLayout,
             hAltFont = CreateFontIndirectW(&aLogFont);
         }
     }
-    while (rLayout.GetNextGlyphs(1, &pGlyph, *pPos, *pGetNextGlypInfo))
+
+    int nStart = 0;
+    Point aPos(0, 0);
+    const GlyphItem* pGlyph;
+    while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
     {
-        bGlyphs = true;
         WORD glyphWStr[] = { pGlyph->maGlyphId };
         if (hAltFont && pGlyph->IsVertical() == bUseAltFont)
         {
             bUseAltFont = !bUseAltFont;
             SelectFont(hDC, bUseAltFont ? hAltFont : hFont);
         }
-        ExtTextOutW(hDC, pPos->X(), pPos->Y(), ETO_GLYPH_INDEX, nullptr, 
LPCWSTR(&glyphWStr), 1, nullptr);
+        ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, nullptr, 
LPCWSTR(&glyphWStr), 1, nullptr);
     }
     if (hAltFont)
     {
@@ -302,7 +301,7 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const 
&rLayout,
         DeleteObject(hAltFont);
     }
 
-    return (pRectToErase && bGlyphs);
+    return true;
 }
 
 D2DWriteTextOutRenderer::D2DWriteTextOutRenderer()
@@ -343,9 +342,7 @@ D2DWriteTextOutRenderer::~D2DWriteTextOutRenderer()
 
 bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
     SalGraphics &rGraphics,
-    HDC hDC,
-    const Rectangle* pRectToErase,
-    Point* pPos, int* pGetNextGlypInfo)
+    HDC hDC)
 {
     if (!Ready())
         return false;
@@ -353,7 +350,7 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout 
const &rLayout,
     if (!BindFont(hDC))
     {
         // If for any reason we can't bind fallback to legacy APIs.
-        return ExTextOutRenderer()(rLayout, rGraphics, hDC, pRectToErase, 
pPos, pGetNextGlypInfo);
+        return ExTextOutRenderer()(rLayout, rGraphics, hDC);
     }
 
     Rectangle bounds;
@@ -365,19 +362,19 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout 
const &rLayout,
     succeeded &= 
SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetRValue(bgrTextColor) / 
255.0f, GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f), 
&pBrush));
 
     HRESULT hr = S_OK;
-    bool bGlyphs = false;
     if (succeeded)
     {
         mpRT->BeginDraw();
 
+        int nStart = 0;
+        Point aPos(0, 0);
         const GlyphItem* pGlyph;
-        while (rLayout.GetNextGlyphs(1, &pGlyph, *pPos, *pGetNextGlypInfo))
+        while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
         {
-            bGlyphs = true;
             UINT16 glyphIndices[] = { pGlyph->maGlyphId };
             FLOAT glyphAdvances[] = { pGlyph->mnNewWidth };
             DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, };
-            D2D1_POINT_2F baseline = { pPos->X() - bounds.Left(), pPos->Y() - 
bounds.Top() };
+            D2D1_POINT_2F baseline = { aPos.X() - bounds.Left(), aPos.Y() - 
bounds.Top() };
             DWRITE_GLYPH_RUN glyphs = {
                 mpFontFace,
                 mlfEmHeight,
@@ -403,7 +400,7 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout 
const &rLayout,
     if (hr == D2DERR_RECREATE_TARGET)
         CreateRenderTarget();
 
-    return (succeeded && bGlyphs && pRectToErase);
+    return succeeded;
 }
 
 bool D2DWriteTextOutRenderer::BindFont(HDC hDC)
@@ -606,11 +603,8 @@ bool WinSalGraphics::DrawCachedGlyphs(const 
CommonSalLayout& rLayout)
 
 void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout, HDC hDC, 
bool bUseDWrite)
 {
-    Point aPos(0, 0);
-    int nGlyphCount(0);
     TextOutRenderer &render = TextOutRenderer::get(bUseDWrite);
-    bool result = render(rLayout, *this, hDC, nullptr, &aPos, &nGlyphCount);
-    assert(!result);
+    render(rLayout, *this, hDC);
 }
 
 void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to