Remove wasteful virtuals according to SizeBench (#11889)
This commit removes some pure virtual base classes from conhost, found with the help of SizeBench. This reduces binary size by 5kB. The reduction in code size however is the main benefit of this. Additionally this fixes a mysterious, undebuggable crash in ~RenderThread(), caused by a Control Flow Guard failure when the class was destroyed over its IRenderThread interface. ## PR Checklist * [x] I work here * [x] Tests added/passed ## Validation Steps Performed * Printing text works ✅ * Printing VT works ✅ * Performance is alright ✅
This commit is contained in:
parent
c8cbf901eb
commit
825efda32f
|
@ -1162,7 +1162,6 @@ IRaw
|
|||
IRead
|
||||
IReference
|
||||
IRender
|
||||
IRenderer
|
||||
IScheme
|
||||
ISelection
|
||||
IShell
|
||||
|
@ -1590,6 +1589,7 @@ NOTSUPPORTED
|
|||
nouicompat
|
||||
nounihan
|
||||
NOUPDATE
|
||||
novtable
|
||||
NOWAIT
|
||||
NOYIELD
|
||||
NOZORDER
|
||||
|
|
|
@ -15,6 +15,11 @@ Author(s):
|
|||
--*/
|
||||
#pragma once
|
||||
|
||||
namespace Microsoft::Console::VirtualTerminal
|
||||
{
|
||||
class ConGetSet;
|
||||
}
|
||||
|
||||
namespace Microsoft::Console
|
||||
{
|
||||
class PtySignalInputThread final
|
||||
|
|
|
@ -4,20 +4,23 @@
|
|||
#pragma once
|
||||
|
||||
#include "../inc/VtIoModes.hpp"
|
||||
#include "../inc/ITerminalOwner.hpp"
|
||||
#include "../renderer/vt/vtrenderer.hpp"
|
||||
#include "VtInputThread.hpp"
|
||||
#include "PtySignalInputThread.hpp"
|
||||
|
||||
class ConsoleArguments;
|
||||
|
||||
namespace Microsoft::Console::Render
|
||||
{
|
||||
class VtEngine;
|
||||
}
|
||||
|
||||
namespace Microsoft::Console::VirtualTerminal
|
||||
{
|
||||
class VtIo : public Microsoft::Console::ITerminalOwner
|
||||
class VtIo
|
||||
{
|
||||
public:
|
||||
VtIo();
|
||||
virtual ~VtIo() override = default;
|
||||
|
||||
[[nodiscard]] HRESULT Initialize(const ConsoleArguments* const pArgs);
|
||||
|
||||
|
@ -33,8 +36,8 @@ namespace Microsoft::Console::VirtualTerminal
|
|||
[[nodiscard]] HRESULT SuppressResizeRepaint();
|
||||
[[nodiscard]] HRESULT SetCursorPosition(const COORD coordCursor);
|
||||
|
||||
void CloseInput() override;
|
||||
void CloseOutput() override;
|
||||
void CloseInput();
|
||||
void CloseOutput();
|
||||
|
||||
void BeginResize();
|
||||
void EndResize();
|
||||
|
|
|
@ -220,7 +220,7 @@ void InputBuffer::FlushAllButKeys()
|
|||
_storage.erase(newEnd, _storage.end());
|
||||
}
|
||||
|
||||
void InputBuffer::SetTerminalConnection(_In_ ITerminalOutputConnection* const pTtyConnection)
|
||||
void InputBuffer::SetTerminalConnection(_In_ Render::VtEngine* const pTtyConnection)
|
||||
{
|
||||
this->_pTtyConnection = pTtyConnection;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ Revision History:
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "inputReadHandleData.h"
|
||||
#include "readData.hpp"
|
||||
#include "../types/inc/IInputEvent.hpp"
|
||||
|
||||
|
@ -26,10 +25,14 @@ Revision History:
|
|||
#include "../server/ObjectHeader.h"
|
||||
#include "../terminal/input/terminalInput.hpp"
|
||||
|
||||
#include "../inc/ITerminalOutputConnection.hpp"
|
||||
|
||||
#include <deque>
|
||||
|
||||
namespace Microsoft::Console::Render
|
||||
{
|
||||
class Renderer;
|
||||
class VtEngine;
|
||||
}
|
||||
|
||||
class InputBuffer final : public ConsoleObjectHeader
|
||||
{
|
||||
public:
|
||||
|
@ -77,7 +80,7 @@ public:
|
|||
|
||||
bool IsInVirtualTerminalInputMode() const;
|
||||
Microsoft::Console::VirtualTerminal::TerminalInput& GetTerminalInput();
|
||||
void SetTerminalConnection(_In_ Microsoft::Console::ITerminalOutputConnection* const pTtyConnection);
|
||||
void SetTerminalConnection(_In_ Microsoft::Console::Render::VtEngine* const pTtyConnection);
|
||||
void PassThroughWin32MouseRequest(bool enable);
|
||||
|
||||
private:
|
||||
|
@ -85,7 +88,7 @@ private:
|
|||
std::unique_ptr<IInputEvent> _readPartialByteSequence;
|
||||
std::unique_ptr<IInputEvent> _writePartialByteSequence;
|
||||
Microsoft::Console::VirtualTerminal::TerminalInput _termInput;
|
||||
Microsoft::Console::ITerminalOutputConnection* _pTtyConnection;
|
||||
Microsoft::Console::Render::VtEngine* _pTtyConnection;
|
||||
|
||||
// This flag is used in _HandleTerminalInputCallback
|
||||
// If the InputBuffer leads to a _HandleTerminalInputCallback call,
|
||||
|
|
|
@ -20,6 +20,7 @@ Revision History:
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "inputReadHandleData.h"
|
||||
#include "../server/IWaitRoutine.h"
|
||||
#include "../server/WaitTerminationReason.h"
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ SCREEN_INFORMATION::~SCREEN_INFORMATION()
|
|||
IWindowMetrics* pMetrics = ServiceLocator::LocateWindowMetrics();
|
||||
THROW_HR_IF_NULL(E_FAIL, pMetrics);
|
||||
|
||||
IAccessibilityNotifier* pNotifier = ServiceLocator::LocateAccessibilityNotifier();
|
||||
const auto pNotifier = ServiceLocator::LocateAccessibilityNotifier();
|
||||
// It is possible for pNotifier to be null and that's OK.
|
||||
// For instance, the PTY doesn't need to send events. Just pass it along
|
||||
// and be sure that `SCREEN_INFORMATION` bypasses all event work if it's not there.
|
||||
|
@ -2312,7 +2312,7 @@ void SCREEN_INFORMATION::SetViewport(const Viewport& newViewport,
|
|||
// sequence we didn't understand to.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void SCREEN_INFORMATION::SetTerminalConnection(_In_ ITerminalOutputConnection* const pTtyConnection)
|
||||
void SCREEN_INFORMATION::SetTerminalConnection(_In_ VtEngine* const pTtyConnection)
|
||||
{
|
||||
OutputStateMachineEngine& engine = reinterpret_cast<OutputStateMachineEngine&>(_stateMachine->Engine());
|
||||
if (pTtyConnection)
|
||||
|
|
|
@ -42,8 +42,6 @@ Revision History:
|
|||
#include "../interactivity/inc/IConsoleWindow.hpp"
|
||||
#include "../interactivity/inc/IWindowMetrics.hpp"
|
||||
|
||||
#include "../inc/ITerminalOutputConnection.hpp"
|
||||
|
||||
#include "../renderer/inc/FontInfo.hpp"
|
||||
#include "../renderer/inc/FontInfoDesired.hpp"
|
||||
|
||||
|
@ -222,7 +220,7 @@ public:
|
|||
[[nodiscard]] HRESULT VtEraseAll();
|
||||
[[nodiscard]] HRESULT ClearBuffer();
|
||||
|
||||
void SetTerminalConnection(_In_ Microsoft::Console::ITerminalOutputConnection* const pTtyConnection);
|
||||
void SetTerminalConnection(_In_ Microsoft::Console::Render::VtEngine* const pTtyConnection);
|
||||
|
||||
void UpdateBottom();
|
||||
void MoveToBottom();
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
/*
|
||||
Module Name:
|
||||
- ITerminalOutputConnection.hpp
|
||||
|
||||
Abstract:
|
||||
- Provides an abstraction for writing to the output pipe connected to the TTY.
|
||||
In conpty mode, this is implemented by the VtRenderer, such that other
|
||||
parts of the codebase (the state machine) can write VT sequences directly
|
||||
to the terminal controlling us.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Microsoft::Console
|
||||
{
|
||||
class ITerminalOutputConnection
|
||||
{
|
||||
public:
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 26432) // suppress rule of 5 violation on interface because tampering with this is fraught with peril
|
||||
virtual ~ITerminalOutputConnection() = 0;
|
||||
|
||||
[[nodiscard]] virtual HRESULT WriteTerminalUtf8(const std::string_view str) = 0;
|
||||
[[nodiscard]] virtual HRESULT WriteTerminalW(const std::wstring_view wstr) = 0;
|
||||
};
|
||||
|
||||
inline Microsoft::Console::ITerminalOutputConnection::~ITerminalOutputConnection() {}
|
||||
#pragma warning(pop)
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- ITerminalOwner.hpp
|
||||
|
||||
Abstract:
|
||||
- Provides an abstraction for Closing the Input/Output objects of a terminal
|
||||
connection. This is implemented by VtIo in the host, and is used by the
|
||||
renderer to be able to tell the VtIo object that the renderer has had it's
|
||||
pipe broken.
|
||||
|
||||
Author(s):
|
||||
- Mike Griese (migrie) 28 March 2018
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Microsoft::Console
|
||||
{
|
||||
class ITerminalOwner
|
||||
{
|
||||
public:
|
||||
virtual ~ITerminalOwner() = 0;
|
||||
|
||||
virtual void CloseInput() = 0;
|
||||
virtual void CloseOutput() = 0;
|
||||
};
|
||||
|
||||
// See docs/virtual-dtors.md for an explanation of why this is weird.
|
||||
inline Microsoft::Console::ITerminalOwner::~ITerminalOwner() {}
|
||||
}
|
|
@ -322,7 +322,7 @@ VOID ConIoSrvComm::ServiceInputPipe()
|
|||
VOID ConIoSrvComm::HandleFocusEvent(PCIS_EVENT Event)
|
||||
{
|
||||
BOOL Ret;
|
||||
IRenderer* Renderer;
|
||||
Renderer* Renderer;
|
||||
CIS_EVENT ReplyEvent;
|
||||
|
||||
Renderer = ServiceLocator::LocateGlobals().pRender;
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include <cwchar>
|
||||
|
||||
#include "../inc/FontInfoBase.hpp"
|
||||
|
||||
FontInfoBase::FontInfoBase(const std::wstring_view& faceName,
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
<ClInclude Include="..\..\inc\IFontDefaultList.hpp" />
|
||||
<ClInclude Include="..\..\inc\IRenderData.hpp" />
|
||||
<ClInclude Include="..\..\inc\IRenderEngine.hpp" />
|
||||
<ClInclude Include="..\..\inc\IRenderer.hpp" />
|
||||
<ClInclude Include="..\..\inc\IRenderTarget.hpp" />
|
||||
<ClInclude Include="..\..\inc\RenderEngineBase.hpp" />
|
||||
<ClInclude Include="..\precomp.h" />
|
||||
|
|
|
@ -77,9 +77,6 @@
|
|||
<ClInclude Include="..\..\inc\IRenderEngine.hpp">
|
||||
<Filter>Header Files\inc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\inc\IRenderer.hpp">
|
||||
<Filter>Header Files\inc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\inc\RenderEngineBase.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "renderer.hpp"
|
||||
|
||||
#pragma hdrstop
|
||||
|
@ -32,7 +31,7 @@ static constexpr auto renderBackoffBaseTimeMilliseconds{ 150 };
|
|||
Renderer::Renderer(IRenderData* pData,
|
||||
_In_reads_(cEngines) IRenderEngine** const rgpEngines,
|
||||
const size_t cEngines,
|
||||
std::unique_ptr<IRenderThread> thread) :
|
||||
std::unique_ptr<RenderThread> thread) :
|
||||
_pData(THROW_HR_IF_NULL(E_INVALIDARG, pData)),
|
||||
_pThread{ std::move(thread) },
|
||||
_viewport{ pData->GetViewport() }
|
||||
|
@ -51,7 +50,7 @@ Renderer::Renderer(IRenderData* pData,
|
|||
// - <none>
|
||||
Renderer::~Renderer()
|
||||
{
|
||||
// IRenderThread blocks until it has shut down.
|
||||
// RenderThread blocks until it has shut down.
|
||||
_destructing = true;
|
||||
_pThread.reset();
|
||||
}
|
||||
|
|
|
@ -16,9 +16,7 @@ Author(s):
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../inc/IRenderer.hpp"
|
||||
#include "../inc/IRenderEngine.hpp"
|
||||
#include "../inc/IRenderData.hpp"
|
||||
#include "../inc/IRenderTarget.hpp"
|
||||
|
||||
#include "thread.hpp"
|
||||
|
||||
|
@ -27,19 +25,19 @@ Author(s):
|
|||
|
||||
namespace Microsoft::Console::Render
|
||||
{
|
||||
class Renderer sealed : public IRenderer
|
||||
class Renderer : public IRenderTarget
|
||||
{
|
||||
public:
|
||||
Renderer(IRenderData* pData,
|
||||
_In_reads_(cEngines) IRenderEngine** const pEngine,
|
||||
const size_t cEngines,
|
||||
std::unique_ptr<IRenderThread> thread);
|
||||
std::unique_ptr<RenderThread> thread);
|
||||
|
||||
virtual ~Renderer() override;
|
||||
virtual ~Renderer();
|
||||
|
||||
[[nodiscard]] HRESULT PaintFrame();
|
||||
|
||||
void TriggerSystemRedraw(const RECT* const prcDirtyClient) override;
|
||||
void TriggerSystemRedraw(const RECT* const prcDirtyClient);
|
||||
void TriggerRedraw(const Microsoft::Console::Types::Viewport& region) override;
|
||||
void TriggerRedraw(const COORD* const pcoord) override;
|
||||
void TriggerRedrawCursor(const COORD* const pcoord) override;
|
||||
|
@ -55,23 +53,23 @@ namespace Microsoft::Console::Render
|
|||
|
||||
void TriggerFontChange(const int iDpi,
|
||||
const FontInfoDesired& FontInfoDesired,
|
||||
_Out_ FontInfo& FontInfo) override;
|
||||
_Out_ FontInfo& FontInfo);
|
||||
|
||||
void UpdateSoftFont(const gsl::span<const uint16_t> bitPattern,
|
||||
const SIZE cellSize,
|
||||
const size_t centeringHint) override;
|
||||
const size_t centeringHint);
|
||||
|
||||
[[nodiscard]] HRESULT GetProposedFont(const int iDpi,
|
||||
const FontInfoDesired& FontInfoDesired,
|
||||
_Out_ FontInfo& FontInfo) override;
|
||||
_Out_ FontInfo& FontInfo);
|
||||
|
||||
bool IsGlyphWideByFont(const std::wstring_view glyph) override;
|
||||
bool IsGlyphWideByFont(const std::wstring_view glyph);
|
||||
|
||||
void EnablePainting() override;
|
||||
void WaitForPaintCompletionAndDisable(const DWORD dwTimeoutMs) override;
|
||||
void WaitUntilCanRender() override;
|
||||
void EnablePainting();
|
||||
void WaitForPaintCompletionAndDisable(const DWORD dwTimeoutMs);
|
||||
void WaitUntilCanRender();
|
||||
|
||||
void AddRenderEngine(_In_ IRenderEngine* const pEngine) override;
|
||||
void AddRenderEngine(_In_ IRenderEngine* const pEngine);
|
||||
|
||||
void SetRendererEnteredErrorStateCallback(std::function<void()> pfn);
|
||||
void ResetErrorStateAndResume();
|
||||
|
@ -103,7 +101,7 @@ namespace Microsoft::Console::Render
|
|||
|
||||
std::array<IRenderEngine*, 2> _engines{};
|
||||
IRenderData* _pData = nullptr; // Non-ownership pointer
|
||||
std::unique_ptr<IRenderThread> _pThread;
|
||||
std::unique_ptr<RenderThread> _pThread;
|
||||
static constexpr size_t _firstSoftFontChar = 0xEF20;
|
||||
size_t _lastSoftFontChar = 0;
|
||||
std::optional<interval_tree::IntervalTree<til::point, size_t>::interval> _hoveredInterval;
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "thread.hpp"
|
||||
|
||||
#include "renderer.hpp"
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
using namespace Microsoft::Console::Render;
|
||||
|
@ -56,12 +57,12 @@ RenderThread::~RenderThread()
|
|||
// - Create all of the Events we'll need, and the actual thread we'll be doing
|
||||
// work on.
|
||||
// Arguments:
|
||||
// - pRendererParent: the IRenderer that owns this thread, and which we should
|
||||
// - pRendererParent: the Renderer that owns this thread, and which we should
|
||||
// trigger frames for.
|
||||
// Return Value:
|
||||
// - S_OK if we succeeded, else an HRESULT corresponding to a failure to create
|
||||
// an Event or Thread.
|
||||
[[nodiscard]] HRESULT RenderThread::Initialize(IRenderer* const pRendererParent) noexcept
|
||||
[[nodiscard]] HRESULT RenderThread::Initialize(Renderer* const pRendererParent) noexcept
|
||||
{
|
||||
_pRenderer = pRendererParent;
|
||||
|
||||
|
|
|
@ -14,24 +14,23 @@ Author(s):
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../inc/IRenderer.hpp"
|
||||
#include "../inc/IRenderThread.hpp"
|
||||
|
||||
namespace Microsoft::Console::Render
|
||||
{
|
||||
class RenderThread final : public IRenderThread
|
||||
class Renderer;
|
||||
|
||||
class RenderThread
|
||||
{
|
||||
public:
|
||||
RenderThread();
|
||||
virtual ~RenderThread() override;
|
||||
~RenderThread();
|
||||
|
||||
[[nodiscard]] HRESULT Initialize(_In_ IRenderer* const pRendererParent) noexcept;
|
||||
[[nodiscard]] HRESULT Initialize(Renderer* const pRendererParent) noexcept;
|
||||
|
||||
void NotifyPaint() override;
|
||||
void NotifyPaint();
|
||||
|
||||
void EnablePainting() override;
|
||||
void DisablePainting() override;
|
||||
void WaitForPaintCompletionAndDisable(const DWORD dwTimeoutMs) override;
|
||||
void EnablePainting();
|
||||
void DisablePainting();
|
||||
void WaitForPaintCompletionAndDisable(const DWORD dwTimeoutMs);
|
||||
|
||||
private:
|
||||
static DWORD WINAPI s_ThreadProc(_In_ LPVOID lpParameter);
|
||||
|
@ -43,7 +42,7 @@ namespace Microsoft::Console::Render
|
|||
HANDLE _hPaintEnabledEvent;
|
||||
HANDLE _hPaintCompletedEvent;
|
||||
|
||||
IRenderer* _pRenderer; // Non-ownership pointer
|
||||
Renderer* _pRenderer; // Non-ownership pointer
|
||||
|
||||
bool _fKeepRunning;
|
||||
std::atomic<bool> _fNextFrameRequested;
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Microsoft::Console::Render
|
|||
std::optional<CursorOptions> cursorInfo;
|
||||
};
|
||||
|
||||
class IRenderEngine
|
||||
class __declspec(novtable) IRenderEngine
|
||||
{
|
||||
public:
|
||||
enum class GridLines
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- IRenderThread.hpp
|
||||
|
||||
Abstract:
|
||||
- an abstraction for all the actions a render thread needs to perform.
|
||||
|
||||
Author(s):
|
||||
- Mike Griese (migrie) 16 Jan 2019
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
namespace Microsoft::Console::Render
|
||||
{
|
||||
class IRenderThread
|
||||
{
|
||||
public:
|
||||
virtual ~IRenderThread() = 0;
|
||||
IRenderThread(const IRenderThread&) = default;
|
||||
IRenderThread(IRenderThread&&) = default;
|
||||
IRenderThread& operator=(const IRenderThread&) = default;
|
||||
IRenderThread& operator=(IRenderThread&&) = default;
|
||||
|
||||
virtual void NotifyPaint() = 0;
|
||||
virtual void EnablePainting() = 0;
|
||||
virtual void DisablePainting() = 0;
|
||||
virtual void WaitForPaintCompletionAndDisable(const DWORD dwTimeoutMs) = 0;
|
||||
|
||||
protected:
|
||||
IRenderThread() = default;
|
||||
};
|
||||
|
||||
inline Microsoft::Console::Render::IRenderThread::~IRenderThread(){};
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- IRenderer.hpp
|
||||
|
||||
Abstract:
|
||||
- This serves as the entry point for console rendering activities.
|
||||
|
||||
Author(s):
|
||||
- Michael Niksa (MiNiksa) 17-Nov-2015
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "FontInfoDesired.hpp"
|
||||
#include "IRenderEngine.hpp"
|
||||
#include "IRenderTarget.hpp"
|
||||
#include "../types/inc/viewport.hpp"
|
||||
|
||||
namespace Microsoft::Console::Render
|
||||
{
|
||||
class IRenderer : public IRenderTarget
|
||||
{
|
||||
public:
|
||||
~IRenderer() = 0;
|
||||
IRenderer(const IRenderer&) = default;
|
||||
IRenderer(IRenderer&&) = default;
|
||||
IRenderer& operator=(const IRenderer&) = default;
|
||||
IRenderer& operator=(IRenderer&&) = default;
|
||||
|
||||
[[nodiscard]] virtual HRESULT PaintFrame() = 0;
|
||||
|
||||
virtual void TriggerSystemRedraw(const RECT* const prcDirtyClient) = 0;
|
||||
|
||||
virtual void TriggerRedraw(const Microsoft::Console::Types::Viewport& region) = 0;
|
||||
virtual void TriggerRedraw(const COORD* const pcoord) = 0;
|
||||
virtual void TriggerRedrawCursor(const COORD* const pcoord) = 0;
|
||||
|
||||
virtual void TriggerRedrawAll() = 0;
|
||||
virtual void TriggerTeardown() noexcept = 0;
|
||||
|
||||
virtual void TriggerSelection() = 0;
|
||||
virtual void TriggerScroll() = 0;
|
||||
virtual void TriggerScroll(const COORD* const pcoordDelta) = 0;
|
||||
virtual void TriggerCircling() = 0;
|
||||
virtual void TriggerTitleChange() = 0;
|
||||
virtual void TriggerFontChange(const int iDpi,
|
||||
const FontInfoDesired& FontInfoDesired,
|
||||
_Out_ FontInfo& FontInfo) = 0;
|
||||
|
||||
virtual void UpdateSoftFont(const gsl::span<const uint16_t> bitPattern,
|
||||
const SIZE cellSize,
|
||||
const size_t centeringHint) = 0;
|
||||
|
||||
[[nodiscard]] virtual HRESULT GetProposedFont(const int iDpi,
|
||||
const FontInfoDesired& FontInfoDesired,
|
||||
_Out_ FontInfo& FontInfo) = 0;
|
||||
|
||||
virtual bool IsGlyphWideByFont(const std::wstring_view glyph) = 0;
|
||||
|
||||
virtual void EnablePainting() = 0;
|
||||
virtual void WaitForPaintCompletionAndDisable(const DWORD dwTimeoutMs) = 0;
|
||||
virtual void WaitUntilCanRender() = 0;
|
||||
|
||||
virtual void AddRenderEngine(_In_ IRenderEngine* const pEngine) = 0;
|
||||
|
||||
protected:
|
||||
IRenderer() = default;
|
||||
};
|
||||
|
||||
inline Microsoft::Console::Render::IRenderer::~IRenderer() {}
|
||||
|
||||
}
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "precomp.h"
|
||||
#include "vtrenderer.hpp"
|
||||
|
||||
#include "../renderer/base/renderer.hpp"
|
||||
#include "../../inc/conattrs.hpp"
|
||||
|
||||
#pragma hdrstop
|
||||
|
|
|
@ -512,7 +512,7 @@ CATCH_RETURN();
|
|||
}
|
||||
|
||||
// Method Description:
|
||||
// - Wrapper for ITerminalOutputConnection. Write either an ascii-only, or a
|
||||
// - Wrapper for _Write. Write either an ascii-only, or a
|
||||
// proper utf-8 string, depending on our mode.
|
||||
// Arguments:
|
||||
// - wstr - wstring of text to be written
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "precomp.h"
|
||||
#include "vtrenderer.hpp"
|
||||
#include "../../inc/conattrs.hpp"
|
||||
#include "../../types/inc/convert.hpp"
|
||||
#include "../../host/VtIo.hpp"
|
||||
|
||||
// For _vcprintf
|
||||
#include <conio.h>
|
||||
|
@ -133,7 +133,7 @@ VtEngine::VtEngine(_In_ wil::unique_hfile pipe,
|
|||
}
|
||||
|
||||
// Method Description:
|
||||
// - Wrapper for ITerminalOutputConnection. See _Write.
|
||||
// - Wrapper for _Write.
|
||||
[[nodiscard]] HRESULT VtEngine::WriteTerminalUtf8(const std::string_view str) noexcept
|
||||
{
|
||||
return _Write(str);
|
||||
|
@ -359,7 +359,7 @@ bool VtEngine::_AllIsInvalid() const
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
void VtEngine::SetTerminalOwner(Microsoft::Console::ITerminalOwner* const terminalOwner)
|
||||
void VtEngine::SetTerminalOwner(Microsoft::Console::VirtualTerminal::VtIo* const terminalOwner)
|
||||
{
|
||||
_terminalOwner = terminalOwner;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@ Author(s):
|
|||
#pragma once
|
||||
|
||||
#include "../inc/RenderEngineBase.hpp"
|
||||
#include "../../inc/ITerminalOutputConnection.hpp"
|
||||
#include "../../inc/ITerminalOwner.hpp"
|
||||
#include "../../types/inc/Viewport.hpp"
|
||||
#include "tracing.hpp"
|
||||
#include <string>
|
||||
|
@ -31,9 +29,14 @@ namespace TerminalCoreUnitTests
|
|||
};
|
||||
#endif
|
||||
|
||||
namespace Microsoft::Console::VirtualTerminal
|
||||
{
|
||||
class VtIo;
|
||||
}
|
||||
|
||||
namespace Microsoft::Console::Render
|
||||
{
|
||||
class VtEngine : public RenderEngineBase, public Microsoft::Console::ITerminalOutputConnection
|
||||
class VtEngine : public RenderEngineBase
|
||||
{
|
||||
public:
|
||||
// See _PaintUtf8BufferLine for explanation of this value.
|
||||
|
@ -73,7 +76,7 @@ namespace Microsoft::Console::Render
|
|||
[[nodiscard]] HRESULT InheritCursor(const COORD coordCursor) noexcept;
|
||||
[[nodiscard]] HRESULT WriteTerminalUtf8(const std::string_view str) noexcept;
|
||||
[[nodiscard]] virtual HRESULT WriteTerminalW(const std::wstring_view str) noexcept = 0;
|
||||
void SetTerminalOwner(Microsoft::Console::ITerminalOwner* const terminalOwner);
|
||||
void SetTerminalOwner(Microsoft::Console::VirtualTerminal::VtIo* const terminalOwner);
|
||||
void BeginResizeRequest();
|
||||
void EndResizeRequest();
|
||||
void SetResizeQuirk(const bool resizeQuirk);
|
||||
|
@ -113,7 +116,7 @@ namespace Microsoft::Console::Render
|
|||
|
||||
bool _pipeBroken;
|
||||
HRESULT _exitResult;
|
||||
Microsoft::Console::ITerminalOwner* _terminalOwner;
|
||||
Microsoft::Console::VirtualTerminal::VtIo* _terminalOwner;
|
||||
|
||||
Microsoft::Console::VirtualTerminal::RenderTracing _trace;
|
||||
bool _inResizeRequest{ false };
|
||||
|
|
|
@ -2,20 +2,17 @@
|
|||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "stateMachine.hpp"
|
||||
#include "OutputStateMachineEngine.hpp"
|
||||
#include "base64.hpp"
|
||||
|
||||
#include "ascii.hpp"
|
||||
#include "base64.hpp"
|
||||
#include "stateMachine.hpp"
|
||||
#include "../../types/inc/utils.hpp"
|
||||
#include "../renderer/vt/vtrenderer.hpp"
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace Microsoft::Console::VirtualTerminal;
|
||||
|
||||
// the console uses 0xffffffff as an "invalid color" value
|
||||
constexpr COLORREF INVALID_COLOR = 0xffffffff;
|
||||
|
||||
// takes ownership of pDispatch
|
||||
OutputStateMachineEngine::OutputStateMachineEngine(std::unique_ptr<ITermDispatch> pDispatch) :
|
||||
_dispatch(std::move(pDispatch)),
|
||||
|
@ -1085,7 +1082,7 @@ CATCH_LOG_RETURN_FALSE()
|
|||
// currently processing.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void OutputStateMachineEngine::SetTerminalConnection(ITerminalOutputConnection* const pTtyConnection,
|
||||
void OutputStateMachineEngine::SetTerminalConnection(Render::VtEngine* const pTtyConnection,
|
||||
std::function<bool()> pfnFlushToTerminal)
|
||||
{
|
||||
this->_pTtyConnection = pTtyConnection;
|
||||
|
|
|
@ -15,7 +15,11 @@ Abstract:
|
|||
#include "../adapter/termDispatch.hpp"
|
||||
#include "telemetry.hpp"
|
||||
#include "IStateMachineEngine.hpp"
|
||||
#include "../../inc/ITerminalOutputConnection.hpp"
|
||||
|
||||
namespace Microsoft::Console::Render
|
||||
{
|
||||
class VtEngine;
|
||||
}
|
||||
|
||||
namespace Microsoft::Console::VirtualTerminal
|
||||
{
|
||||
|
@ -56,7 +60,7 @@ namespace Microsoft::Console::VirtualTerminal
|
|||
bool DispatchControlCharsFromEscape() const noexcept override;
|
||||
bool DispatchIntermediatesFromEscape() const noexcept override;
|
||||
|
||||
void SetTerminalConnection(Microsoft::Console::ITerminalOutputConnection* const pTtyConnection,
|
||||
void SetTerminalConnection(Microsoft::Console::Render::VtEngine* const pTtyConnection,
|
||||
std::function<bool()> pfnFlushToTerminal);
|
||||
|
||||
const ITermDispatch& Dispatch() const noexcept;
|
||||
|
@ -64,7 +68,7 @@ namespace Microsoft::Console::VirtualTerminal
|
|||
|
||||
private:
|
||||
std::unique_ptr<ITermDispatch> _dispatch;
|
||||
Microsoft::Console::ITerminalOutputConnection* _pTtyConnection;
|
||||
Microsoft::Console::Render::VtEngine* _pTtyConnection;
|
||||
std::function<bool()> _pfnFlushToTerminal;
|
||||
wchar_t _lastPrintedChar;
|
||||
|
||||
|
|
Loading…
Reference in New Issue