From 846a8aa7a682fead0a98f6b8a9e1f206645c5a5c Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Sun, 23 Jun 2024 12:09:42 +0200 Subject: [PATCH] Fix builtin glyph corruption in the D2D renderer (#17464) The initial contents of a texture are undefined. That's not good. Now they are. That's good. (cherry picked from commit 8c14a34263165bb3ab0a3689dc49840159a17820) Service-Card-Id: 92788897 Service-Version: 1.21 --- src/renderer/atlas/BackendD2D.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/renderer/atlas/BackendD2D.cpp b/src/renderer/atlas/BackendD2D.cpp index cf7bd8a2bec..748fb0e8cbf 100644 --- a/src/renderer/atlas/BackendD2D.cpp +++ b/src/renderer/atlas/BackendD2D.cpp @@ -394,8 +394,14 @@ void BackendD2D::_prepareBuiltinGlyphRenderTarget(const RenderingPayload& p) THROW_IF_FAILED(target->GetBitmap(_builtinGlyphsBitmap.put())); _builtinGlyphsRenderTarget = target.query(); _builtinGlyphsBitmapCellCountU = cellCountU; - _builtinGlyphsRenderTargetActive = false; memset(&_builtinGlyphsReady[0], 0, sizeof(_builtinGlyphsReady)); + + _builtinGlyphsRenderTarget->BeginDraw(); + _builtinGlyphsRenderTargetActive = true; + + // The initial contents of the bitmap are undefined. + // -> We need to define them. :) + _builtinGlyphsRenderTarget->Clear(); } D2D1_RECT_U BackendD2D::_prepareBuiltinGlyph(const RenderingPayload& p, char32_t ch, u32 off)