UI: Clear font bitmap after aligning size.

Otherwise we get remnants from previous draws, oops.
This commit is contained in:
Unknown W. Brackets committed 2017-11-23 09:04:15 -08:00
1 parent c04ead1023
commit 826e9d2ee1
1 file changed
+6 -8
+6 -8
View File
@@ -227,14 +227,6 @@ void TextDrawerWin32::DrawString(DrawBuffer &target, const char *str, float x, f
size.cx = textRect.right;
size.cy = textRect.bottom;
// GetTextExtentPoint32(ctx_->hDC, wstr.c_str(), (int)wstr.size(), &size);
RECT rc = { 0 };
rc.right = size.cx + 4;
rc.bottom = size.cy + 4;
FillRect(ctx_->hDC, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
//ExtTextOut(ctx_->hDC, 0, 0, ETO_OPAQUE | ETO_CLIPPED, NULL, wstr.c_str(), (int)wstr.size(), NULL);
DrawTextExW(ctx_->hDC, (LPWSTR)wstr.c_str(), (int)wstr.size(), &rc, DT_HIDEPREFIX | DT_TOP | dtAlign, 0);
if (size.cx > MAX_TEXT_WIDTH)
size.cx = MAX_TEXT_WIDTH;
if (size.cy > MAX_TEXT_HEIGHT)
@@ -247,6 +239,12 @@ void TextDrawerWin32::DrawString(DrawBuffer &target, const char *str, float x, f
entry->bmHeight = (size.cy + 3) & ~3;
entry->lastUsedFrame = frameCount_;
RECT rc = { 0 };
rc.right = entry->bmWidth;
rc.bottom = entry->bmHeight;
FillRect(ctx_->hDC, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
DrawTextExW(ctx_->hDC, (LPWSTR)wstr.c_str(), (int)wstr.size(), &rc, DT_HIDEPREFIX | DT_TOP | dtAlign, 0);
DataFormat texFormat;
// For our purposes these are equivalent, so just choose the supported one. D3D can emulate them.
if (draw_->GetDataFormatSupport(Draw::DataFormat::A4R4G4B4_UNORM_PACK16) & FMT_TEXTURE)