[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - vcl/win

Tim Eves tim_eves at sil.org
Tue May 10 09:00:51 UTC 2016


 vcl/win/source/gdi/winlayout.cxx |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit a263a497722ddda21b47423dbde0c473020a8c55
Author: Tim Eves <tim_eves at sil.org>
Date:   Tue May 10 09:47:30 2016 +0700

    tdf#99207: Fix incorrect RGB ordering in Graphite DWrite path
    
    Direct 2D accepts colours specified as UINT32 ARGB values or
    floats. However GDI presents colours as COLOREFS which are 32 bit
    FBGR (F is a flag not an alpha) values. Passing a COLORREF to
    D2D1:ColorF swaps the red and blue channels. This patch converts
    the COLORREF into RGB float triples using the GDI colour macros.
    
    Change-Id: Iee5c00bfb10fa8771a2a1019976f70633cca4094
    Reviewed-on: https://gerrit.libreoffice.org/24819
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Martin Hosken <martin_hosken at sil.org>
    Reviewed-on: https://gerrit.libreoffice.org/24823

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index aa42a19..170c94b 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -3730,8 +3730,9 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
     }
     succeeded &= BindDC(hDC, bounds);   // Update the bounding rect.
 
-    ID2D1SolidColorBrush* pBlackBrush = NULL;
-    succeeded &= SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetTextColor(hDC)), &pBlackBrush));
+    ID2D1SolidColorBrush* pBrush = NULL;
+    COLORREF bgrTextColor = GetTextColor(mhDC);
+    succeeded &= SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetRValue(bgrTextColor) / 255.0f, GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f), &pBrush));
 
     HRESULT hr = S_OK;
     int nGlyphs = 0;
@@ -3766,14 +3767,14 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
                 0
             };
 
-            mpRT->DrawGlyphRun(baseline, &glyphs, pBlackBrush);
+            mpRT->DrawGlyphRun(baseline, &glyphs, pBrush);
         } while (!pRectToErase);
 
         hr = mpRT->EndDraw();
     }
 
-    if (pBlackBrush)
-        pBlackBrush->Release();
+    if (pBrush)
+        pBrush->Release();
 
     ReleaseFont();
 
@@ -3874,7 +3875,8 @@ bool D2DWriteTextOutRenderer::DrawGlyphs(const Point & origin, uint16_t * pGid,
     bool succeeded = BindDC(mhDC, bounds);   // Update the bounding rect.
 
     ID2D1SolidColorBrush* pBrush = NULL;
-    succeeded &= SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetTextColor(mhDC)), &pBrush));
+    COLORREF bgrTextColor = GetTextColor(mhDC);
+    succeeded &= SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetRValue(bgrTextColor) / 255.0f, GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f), &pBrush));
 
     HRESULT hr = S_OK;
     if (succeeded)


More information about the Libreoffice-commits mailing list