Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace GetDefaultBrushColors with hardcoded default attributes #11982

Merged
1 commit merged into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cascadia/PublicTerminalCore/HwndTerminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ try
{
const auto& fontData = _actualFont;
int const iFontHeightPoints = fontData.GetUnscaledSize().Y; // this renderer uses points already
const COLORREF bgColor = _terminal->GetAttributeColors(_terminal->GetDefaultBrushColors()).second;
const COLORREF bgColor = _terminal->GetAttributeColors({}).second;

std::string HTMLToPlaceOnClip = TextBuffer::GenHTML(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor);
_CopyToSystemClipboard(HTMLToPlaceOnClip, L"HTML Format");
Expand Down
1 change: 0 additions & 1 deletion src/cascadia/TerminalCore/Terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ class Microsoft::Terminal::Core::Terminal final :

#pragma region IRenderData
// These methods are defined in TerminalRenderData.cpp
const TextAttribute GetDefaultBrushColors() noexcept override;
COORD GetCursorPosition() const noexcept override;
bool IsCursorVisible() const noexcept override;
bool IsCursorOn() const noexcept override;
Expand Down
5 changes: 0 additions & 5 deletions src/cascadia/TerminalCore/terminalrenderdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ void Terminal::SetFontInfo(const FontInfo& fontInfo)
_fontInfo = fontInfo;
}

const TextAttribute Terminal::GetDefaultBrushColors() noexcept
{
return TextAttribute{};
}

std::pair<COLORREF, COLORREF> Terminal::GetAttributeColors(const TextAttribute& attr) const noexcept
{
std::pair<COLORREF, COLORREF> colors;
Expand Down
11 changes: 0 additions & 11 deletions src/host/renderData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,6 @@ void RenderData::UnlockConsole() noexcept
#pragma endregion

#pragma region IRenderData
// Routine Description:
// - Retrieves the brush colors that should be used in absence of any other color data from
// cells in the text buffer.
// Return Value:
// - TextAttribute containing the foreground and background brush color data.
const TextAttribute RenderData::GetDefaultBrushColors() noexcept
{
const CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
return gci.GetActiveOutputBuffer().GetAttributes();
}

// Method Description:
// - Gets the cursor's position in the buffer, relative to the buffer origin.
// Arguments:
Expand Down
2 changes: 0 additions & 2 deletions src/host/renderData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class RenderData final :
#pragma endregion

#pragma region IRenderData
const TextAttribute GetDefaultBrushColors() noexcept override;

COORD GetCursorPosition() const noexcept override;
bool IsCursorVisible() const noexcept override;
bool IsCursorOn() const noexcept override;
Expand Down
5 changes: 0 additions & 5 deletions src/host/ut_host/VtIoTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,6 @@ class MockRenderData : public IRenderData, IUiaData
{
}

const TextAttribute GetDefaultBrushColors() noexcept override
{
return TextAttribute{};
}

std::pair<COLORREF, COLORREF> GetAttributeColors(const TextAttribute& /*attr*/) const noexcept override
{
return std::make_pair(COLORREF{}, COLORREF{});
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/base/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ try
});

// A. Prep Colors
RETURN_IF_FAILED(_UpdateDrawingBrushes(pEngine, _pData->GetDefaultBrushColors(), false, true));
RETURN_IF_FAILED(_UpdateDrawingBrushes(pEngine, {}, false, true));

// B. Perform Scroll Operations
RETURN_IF_FAILED(_PerformScrolling(pEngine));
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/inc/IRenderData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ namespace Microsoft::Console::Render
IRenderData& operator=(const IRenderData&) = default;
IRenderData& operator=(IRenderData&&) = default;

virtual const TextAttribute GetDefaultBrushColors() noexcept = 0;

virtual COORD GetCursorPosition() const noexcept = 0;
virtual bool IsCursorVisible() const noexcept = 0;
virtual bool IsCursorOn() const noexcept = 0;
Expand Down