summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTim Eves <tim_eves@sil.org>2016-05-10 09:47:30 +0700
committerMartin Hosken <martin_hosken@sil.org>2016-05-10 09:00:25 +0000
commita263a497722ddda21b47423dbde0c473020a8c55 (patch)
treefce12713cf898be835824897f41dd4e112210ff4 /vcl
parentc0ffa8c3a10294b64b6e1a66f8d3c18098974cd6 (diff)
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@libreoffice.org> Reviewed-by: Martin Hosken <martin_hosken@sil.org> Reviewed-on: https://gerrit.libreoffice.org/24823
Diffstat (limited to 'vcl')
-rw-r--r--vcl/win/source/gdi/winlayout.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index aa42a1950306..170c94be21a2 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)