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

Tim Eves tim_eves at sil.org
Tue May 10 07:00:57 UTC 2016


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

New commits:
commit 1caae7289d696686e88f60155cef895c5d781f53
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>

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index be97cfe..7c217b6 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3745,8 +3745,9 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
     bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, bounds);
     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;
@@ -3781,14 +3782,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();
 
@@ -3886,7 +3887,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