mostly cleanup, 7 TODOs remain
This commit is contained in:
parent
03711944f1
commit
4912b65967
|
@ -278,8 +278,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
|
||||
// GH#5098: Inform the engine of the opacity of the default text background.
|
||||
// GH#11315: Always do this, even if they don't have acrylic on.
|
||||
const auto ua = UseAcrylic();
|
||||
_renderEngine->SetDefaultTextBackgroundOpacity(ua);
|
||||
_renderEngine->SetDefaultTextBackgroundOpacity(UseAcrylic());
|
||||
|
||||
THROW_IF_FAILED(_renderEngine->Enable());
|
||||
|
||||
|
@ -441,16 +440,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
0.0,
|
||||
1.0);
|
||||
|
||||
// GH#5098: Inform the engine of the new opacity of the default text background.
|
||||
|
||||
// TODO! This doesn't work when (aa:cleartype && useAcrylic:true &&
|
||||
// opacity<1.0 -> 1.0) We end up forcing the solid BG, but the padding
|
||||
// around the terminal is still acrylic. I think we only need to tell
|
||||
// the engine to do the solid BG trick for useAcrylic:true, not for
|
||||
// vintage opacity. Lets find out.
|
||||
//
|
||||
// SetBackgroundOpacity(newOpacity);
|
||||
|
||||
// Update our runtime opacity value
|
||||
Opacity(newOpacity);
|
||||
|
||||
|
@ -462,16 +451,19 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
// is what the Terminal did prior to 1.12.
|
||||
if (!IsVintageOpacityAvailable())
|
||||
{
|
||||
const auto oldUseAcrylic{ UseAcrylic() };
|
||||
_runtimeUseAcrylic = newOpacity < 1.0;
|
||||
// If they've changed the value of UseAcrylic, then update the
|
||||
// renderer as well.
|
||||
if (oldUseAcrylic != UseAcrylic() && _renderEngine)
|
||||
{
|
||||
// GH#5098: Inform the engine of the new opacity of the default
|
||||
// text background.
|
||||
auto lock = _terminal->LockForWriting();
|
||||
_renderEngine->SetDefaultTextBackgroundOpacity(UseAcrylic());
|
||||
}
|
||||
}
|
||||
|
||||
// if (_renderEngine)
|
||||
// {
|
||||
// auto lock = _terminal->LockForWriting();
|
||||
// const auto ua = UseAcrylic();
|
||||
// _renderEngine->SetDefaultTextBackgroundOpacity(ua);
|
||||
// }
|
||||
|
||||
auto eventArgs = winrt::make_self<TransparencyChangedEventArgs>(newOpacity);
|
||||
_TransparencyChangedHandlers(*this, *eventArgs);
|
||||
}
|
||||
|
@ -638,8 +630,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
_renderEngine->SetForceFullRepaintRendering(_settings->ForceFullRepaintRendering());
|
||||
_renderEngine->SetSoftwareRendering(_settings->SoftwareRendering());
|
||||
// Inform the renderer of our opacity
|
||||
const auto ua = UseAcrylic();
|
||||
_renderEngine->SetDefaultTextBackgroundOpacity(ua);
|
||||
_renderEngine->SetDefaultTextBackgroundOpacity(UseAcrylic());
|
||||
|
||||
_updateAntiAliasingMode(_renderEngine.get());
|
||||
|
||||
|
|
|
@ -340,9 +340,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
foregroundBrush.Color(static_cast<til::color>(newAppearance.DefaultForeground()));
|
||||
TSFInputControl().Foreground(foregroundBrush);
|
||||
|
||||
// TODO!
|
||||
_core.ApplyAppearance(_focused);
|
||||
// _core.UpdateAppearance(newAppearance.try_as<IControlAppearance>());
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
@ -463,22 +461,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
{
|
||||
RootGrid().Background(acrylic);
|
||||
}
|
||||
|
||||
// // GH#5098: Inform the engine of the new opacity of the default text background.
|
||||
// //
|
||||
// // TODO! This sure seems contrived, shouldn't the core... already
|
||||
// // know this?
|
||||
// _core.SetBackgroundOpacity(_core.Opacity());
|
||||
}
|
||||
else
|
||||
{
|
||||
Media::SolidColorBrush solidColor{};
|
||||
solidColor.Opacity(_core.Opacity());
|
||||
RootGrid().Background(solidColor);
|
||||
|
||||
// // GH#5098: Inform the engine of the new opacity of the default text background.
|
||||
// // TODO! here too
|
||||
// _core.SetBackgroundOpacity(_core.Opacity());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2378,22 +2366,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
return _core.Settings();
|
||||
}
|
||||
|
||||
// void TermControl::Settings(IControlSettings newSettings)
|
||||
// {
|
||||
// DebugBreak();
|
||||
// _settings = winrt::make_self<ControlSettings>(newSettings, nullptr);
|
||||
// }
|
||||
|
||||
IControlAppearance TermControl::UnfocusedAppearance() const
|
||||
{
|
||||
return _core.UnfocusedAppearance();
|
||||
}
|
||||
|
||||
// void TermControl::UnfocusedAppearance(IControlAppearance newAppearance)
|
||||
// {
|
||||
// _settings = winrt::make_self<ControlSettings>(_settings.try_as<IControlSettings>(), newAppearance);
|
||||
// }
|
||||
|
||||
Windows::Foundation::IReference<winrt::Windows::UI::Color> TermControl::TabColor() noexcept
|
||||
{
|
||||
// NOTE TO FUTURE READERS: TabColor is down in the Core for the
|
||||
|
|
|
@ -909,6 +909,15 @@ void DxEngine::_ReleaseDeviceResources() noexcept
|
|||
// DANGER: Layers slow us down. Only do this in the specific case where
|
||||
// someone has chosen the slower ClearType antialiasing (versus the faster
|
||||
// grayscale antialiasing)
|
||||
//
|
||||
// October 2021: We're no longer forcing the BG of the run to be opaque when
|
||||
// cleartype is enabled and the background isn't fully opaque. In the case
|
||||
// of (!useAcrylic && opacity<1.0), we actually can still render cleartype
|
||||
// text just fine. It's only acrylic that messes us up. So we're making a
|
||||
// small change. Now, when the user requests acrylic, text that's rendered
|
||||
// on the default text BG will always use grayscale, rather than cleartype.
|
||||
// This helps support the scenario where the user has (useAcrylic &&
|
||||
// opacity==1.0)
|
||||
const bool usingCleartype = _antialiasingMode == D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE;
|
||||
const bool usingTransparency = _defaultBackgroundIsTransparent;
|
||||
// Another way of naming "bgIsDefault" is "bgHasTransparency"
|
||||
|
@ -1930,23 +1939,13 @@ CATCH_RETURN()
|
|||
const bool /*usingSoftFont*/,
|
||||
const bool isSettingDefaultBrushes) noexcept
|
||||
{
|
||||
// GH#5098: If we're rendering with cleartype text, we need to always render
|
||||
// onto an opaque background. If our background's opacity is 1.0f, that's
|
||||
// great, we can actually use cleartype in that case. In that scenario
|
||||
// (cleartype && opacity == 1.0), we'll force the opacity bits of the
|
||||
// COLORREF to 0xff so we draw as cleartype. In any other case, leave the
|
||||
// opacity bits unchanged. PaintBufferLine will later do some logic to
|
||||
// determine if we should paint the text as grayscale or not.
|
||||
const bool usingCleartype = _antialiasingMode == D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE;
|
||||
const bool usingTransparency = _defaultBackgroundIsTransparent;
|
||||
const bool forceOpaqueBG = false; // usingCleartype && usingTransparency;
|
||||
usingCleartype;
|
||||
usingTransparency;
|
||||
|
||||
const auto [colorForeground, colorBackground] = pData->GetAttributeColors(textAttributes);
|
||||
|
||||
_foregroundColor = _ColorFFromColorRef(OPACITY_OPAQUE | colorForeground);
|
||||
_backgroundColor = _ColorFFromColorRef((forceOpaqueBG ? OPACITY_OPAQUE : 0) | colorBackground);
|
||||
// October 2021: small changes were made to the way BG color interacts with
|
||||
// grayscale AA, esp. with regards to acrylic and GH#5098. See comment in
|
||||
// _ShouldForceGrayscaleAA for more details.
|
||||
_backgroundColor = _ColorFFromColorRef(colorBackground);
|
||||
|
||||
_d2dBrushForeground->SetColor(_foregroundColor);
|
||||
_d2dBrushBackground->SetColor(_backgroundColor);
|
||||
|
|
Loading…
Reference in a new issue