diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-10-25 16:29:49 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-11-27 09:55:12 +0100 |
commit | 5ac9a62f3a354db80837bdd1c95b763989b303bb (patch) | |
tree | 94a5bd6875589fa3827c20b84a5edee9da60090b /vcl/win/gdi | |
parent | aa08385d1a07c530d32de91b633dbe087a3848ba (diff) |
fix Skia Windows text rendering
There are two cases in WinSalGraphics::DrawTextLayout(), with and
without cached glyphs:
- Cached case DeferredTextDraw() gets data as BGRA with the glyph
drawn in white, it just needs to be modulated to the proper color
and drawn.
- Uncached case DrawTextMask() gets data as BGRA with A invalid,
it must be used as mask for the color to drawn, but without
the inverse alpha VCL idiosyncracy that DrawMask() handles.
Change-Id: I05dcec994df68d5986cd85cffa42a8f9f23c42c4
Diffstat (limited to 'vcl/win/gdi')
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 06189c6a7643..cf264425ae17 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -171,7 +171,8 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, auto pRT = pTxt->GetRenderTarget(); ID2D1SolidColorBrush* pBrush = nullptr; - if (!SUCCEEDED(pRT->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Black), &pBrush))) + D2D1::ColorF textColor = aDC->wantsTextColorWhite() ? D2D1::ColorF::White : D2D1::ColorF::Black; + if (!SUCCEEDED(pRT->CreateSolidColorBrush(textColor, &pBrush))) return false; D2D1_POINT_2F baseline = { @@ -622,9 +623,9 @@ void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) // the actual drawing DrawTextLayout(rLayout, aDC->getCompatibleHDC(), !bForceGDI); - std::unique_ptr<CompatibleDC::Texture> xTexture(aDC->getTexture()); + std::unique_ptr<CompatibleDC::Texture> xTexture(aDC->getAsMaskTexture()); if (xTexture) - pImpl->DrawMask(xTexture.get(), salColor, aDC->getTwoRect()); + pImpl->DrawTextMask(xTexture.get(), salColor, aDC->getTwoRect()); ::SelectFont(aDC->getCompatibleHDC(), hOrigFont); |