Fix font changes not resizing _invalidMap (#10856)

The `_invalidMap` size is dependent on both `clientSize` as well
as `glyphCellSize` and must be resized when either changes.

## PR Checklist
* [x] Closes #10855
* [x] I work here

## Validation Steps Performed
* Changing font size with Ctrl+Mousewheel in fullscreen works ✔️
This commit is contained in:
Leonard Hecker 2021-08-02 22:54:46 +02:00 committed by GitHub
parent a2a605050f
commit 94166942cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -582,9 +582,6 @@ try
_displaySizePixels = _GetClientSize(); _displaySizePixels = _GetClientSize();
_invalidMap.resize(_displaySizePixels / _fontRenderData->GlyphCell());
RETURN_IF_FAILED(InvalidateAll());
// Get the other device types so we have deeper access to more functionality // Get the other device types so we have deeper access to more functionality
// in our pipeline than by just walking straight from the D3D device. // in our pipeline than by just walking straight from the D3D device.
@ -1288,6 +1285,7 @@ try
if (_isEnabled) if (_isEnabled)
{ {
const auto clientSize = _GetClientSize(); const auto clientSize = _GetClientSize();
const auto glyphCellSize = _fontRenderData->GlyphCell();
// If we don't have device resources or if someone has requested that we // If we don't have device resources or if someone has requested that we
// recreate the device... then make new resources. (Create will dump the old ones.) // recreate the device... then make new resources. (Create will dump the old ones.)
@ -1317,8 +1315,11 @@ try
// And persist the new size. // And persist the new size.
_displaySizePixels = clientSize; _displaySizePixels = clientSize;
}
_invalidMap.resize(clientSize / _fontRenderData->GlyphCell()); if (const auto size = clientSize / glyphCellSize; size != _invalidMap.size())
{
_invalidMap.resize(size);
RETURN_IF_FAILED(InvalidateAll()); RETURN_IF_FAILED(InvalidateAll());
} }
@ -1337,7 +1338,7 @@ try
_ShouldForceGrayscaleAA(), _ShouldForceGrayscaleAA(),
_dwriteFactory.Get(), _dwriteFactory.Get(),
spacing, spacing,
_fontRenderData->GlyphCell(), glyphCellSize,
_d2dDeviceContext->GetSize(), _d2dDeviceContext->GetSize(),
std::nullopt, std::nullopt,
D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT); D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT);