From 5ac9a62f3a354db80837bdd1c95b763989b303bb Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Fri, 25 Oct 2019 16:29:49 +0200 Subject: 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 --- vcl/inc/win/salgdi.h | 7 +++++-- vcl/inc/win/wingdiimpl.hxx | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'vcl/inc/win') diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index f7fb206624b5..fc12bc823b93 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -138,11 +138,14 @@ public: /// Base texture class (OpenGL and Skia will provide their implementations). struct Texture; - /// Obtain the texture. - virtual std::unique_ptr getTexture() { abort(); }; + /// Obtain the texture in format for WinSalGraphicsImplBase::DrawTextMask(). + virtual std::unique_ptr getAsMaskTexture() { abort(); }; /// Copy bitmap data to the texture. Texture must be initialized and the correct size to hold the bitmap. virtual bool copyToTexture(Texture& /*aTexture*/) { abort(); }; + + /// Return true if text glyphs should be drawn as white instead of black. + virtual bool wantsTextColorWhite() const { return false; } }; struct CompatibleDC::Texture diff --git a/vcl/inc/win/wingdiimpl.hxx b/vcl/inc/win/wingdiimpl.hxx index 2264eecf353d..84884220318f 100644 --- a/vcl/inc/win/wingdiimpl.hxx +++ b/vcl/inc/win/wingdiimpl.hxx @@ -39,8 +39,8 @@ public: virtual bool UseTextDraw() const { return false; } virtual void PreDrawText() {} virtual void PostDrawText() {} - virtual void DrawMask(CompatibleDC::Texture* /*rTexture*/, Color /*nMaskColor*/, - const SalTwoRect& /*rPosAry*/) + virtual void DrawTextMask(CompatibleDC::Texture* /*rTexture*/, Color /*nMaskColor*/, + const SalTwoRect& /*rPosAry*/) { abort(); }; -- cgit