Restore DxEngine changes that made it pass AuditMode

This commit is contained in:
Leonard Hecker 2021-11-10 15:07:01 +01:00
parent 481cd40616
commit e78725049b
4 changed files with 21 additions and 18 deletions

View file

@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "precomp.h"
@ -404,9 +404,9 @@ CATCH_RETURN()
std::vector<DWRITE_SHAPING_GLYPH_PROPERTIES> glyphProps(maxGlyphCount);
// Get the features to apply to the font
auto features = _fontRenderData->DefaultFontFeatures();
DWRITE_FONT_FEATURE* featureList = features.data();
DWRITE_TYPOGRAPHIC_FEATURES typographicFeatures = { &featureList[0], gsl::narrow<uint32_t>(features.size()) };
const auto& features = _fontRenderData->DefaultFontFeatures();
#pragma warning(suppress : 26492) // Don't use const_cast to cast away const or volatile (type.3).
DWRITE_TYPOGRAPHIC_FEATURES typographicFeatures = { const_cast<DWRITE_FONT_FEATURE*>(features.data()), gsl::narrow<uint32_t>(features.size()) };
DWRITE_TYPOGRAPHIC_FEATURES const* typographicFeaturesPointer = &typographicFeatures;
const uint32_t fontFeatureLengths[] = { textLength };

View file

@ -487,6 +487,7 @@ CATCH_RETURN()
{
// Color glyph rendering sourced from https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/DWriteColorGlyph
#pragma warning(suppress : 26429) // Symbol 'drawingContext' is never tested for nullness, it can be marked as not_null (f.23).
DrawingContext* drawingContext = static_cast<DrawingContext*>(clientDrawingContext);
// Since we've delegated the drawing of the background of the text into this function, the origin passed in isn't actually the baseline.

View file

@ -248,6 +248,7 @@ void DxEngine::ToggleShaderEffects() noexcept
{
_terminalEffectsEnabled = !_terminalEffectsEnabled;
_recreateDeviceRequested = true;
#pragma warning(suppress : 26447) // The function is declared 'noexcept' but calls function 'Log_IfFailed()' which may throw exceptions (f.6).
LOG_IF_FAILED(InvalidateAll());
}
@ -971,12 +972,12 @@ CATCH_RETURN();
void DxEngine::SetCallback(std::function<void()> pfn) noexcept
{
_pfn = pfn;
_pfn = std::move(pfn);
}
void DxEngine::SetWarningCallback(std::function<void(const HRESULT)> pfn) noexcept
{
_pfnWarningCallback = pfn;
_pfnWarningCallback = std::move(pfn);
}
bool DxEngine::GetRetroTerminalEffect() const noexcept
@ -1046,11 +1047,12 @@ try
}
CATCH_LOG()
HANDLE DxEngine::GetSwapChainHandle()
HANDLE DxEngine::GetSwapChainHandle() noexcept
{
if (!_swapChainHandle)
{
THROW_IF_FAILED(_CreateDeviceResources(true));
#pragma warning(suppress : 26447) // The function is declared 'noexcept' but calls function 'Log_IfFailed()' which may throw exceptions (f.6).
LOG_IF_FAILED(_CreateDeviceResources(true));
}
return _swapChainHandle.get();

View file

@ -49,28 +49,28 @@ namespace Microsoft::Console::Render
// Used to release device resources so that another instance of
// conhost can render to the screen (i.e. only one DirectX
// application may control the screen at a time.)
[[nodiscard]] HRESULT Enable() noexcept;
[[nodiscard]] HRESULT Enable() noexcept override;
[[nodiscard]] HRESULT Disable() noexcept;
[[nodiscard]] HRESULT SetHwnd(const HWND hwnd) noexcept;
[[nodiscard]] HRESULT SetHwnd(const HWND hwnd) noexcept override;
[[nodiscard]] HRESULT SetWindowSize(const SIZE pixels) noexcept;
[[nodiscard]] HRESULT SetWindowSize(const SIZE pixels) noexcept override;
void SetCallback(std::function<void()> pfn) noexcept override;
void SetWarningCallback(std::function<void(const HRESULT)> pfn) noexcept override;
void ToggleShaderEffects() noexcept override;
bool GetRetroTerminalEffect() const noexcept;
void SetRetroTerminalEffect(bool enable) noexcept;
bool GetRetroTerminalEffect() const noexcept override;
void SetRetroTerminalEffect(bool enable) noexcept override;
void SetPixelShaderPath(std::wstring_view value) noexcept;
void SetPixelShaderPath(std::wstring_view value) noexcept override;
void SetForceFullRepaintRendering(bool enable) noexcept;
void SetForceFullRepaintRendering(bool enable) noexcept override;
void SetSoftwareRendering(bool enable) noexcept;
void SetSoftwareRendering(bool enable) noexcept override;
HANDLE GetSwapChainHandle();
HANDLE GetSwapChainHandle() noexcept override;
// IRenderEngine Members
[[nodiscard]] HRESULT Invalidate(const SMALL_RECT* const psrRegion) noexcept override;
@ -110,7 +110,7 @@ namespace Microsoft::Console::Render
const bool usingSoftFont,
const bool isSettingDefaultBrushes) noexcept override;
[[nodiscard]] HRESULT UpdateFont(const FontInfoDesired& fiFontInfoDesired, FontInfo& fiFontInfo) noexcept override;
[[nodiscard]] HRESULT UpdateFont(const FontInfoDesired& fiFontInfoDesired, FontInfo& fiFontInfo, const std::unordered_map<std::wstring_view, uint32_t>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept;
[[nodiscard]] HRESULT UpdateFont(const FontInfoDesired& fiFontInfoDesired, FontInfo& fiFontInfo, const std::unordered_map<std::wstring_view, uint32_t>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept override;
[[nodiscard]] HRESULT UpdateDpi(int const iDpi) noexcept override;
[[nodiscard]] HRESULT UpdateViewport(const SMALL_RECT srNewViewport) noexcept override;