Bug 1923799 - For opaque windows, don't bother clearing the nc-area on resize. r=win-reviewers,rkraesig

Differential Revision: https://phabricator.services.mozilla.com/D225339
This commit is contained in:
Emilio Cobos Álvarez 2024-10-11 20:55:59 +00:00
parent b40948fe6e
commit 114d7ff344

View File

@ -209,19 +209,19 @@ bool nsWindow::OnPaint(uint32_t aNestingLevel) {
translucentRegion.SubOut(mOpaqueRegion);
region.OrWith(translucentRegion);
}
}
if (!usingMemoryDC && (mNeedsNCAreaClear || didResize)) {
// We need to clear the non-client-area region, and the transparent parts
// of the window to black (once).
auto black = reinterpret_cast<HBRUSH>(::GetStockObject(BLACK_BRUSH));
nsAutoRegion regionToClear(ComputeNonClientHRGN());
if (mTransparencyMode == TransparencyMode::Transparent &&
!translucentRegion.IsEmpty()) {
nsAutoRegion translucent(WinUtils::RegionToHRGN(translucentRegion));
::CombineRgn(regionToClear, regionToClear, translucent, RGN_OR);
if (mNeedsNCAreaClear ||
(didResize && mTransparencyMode == TransparencyMode::Transparent)) {
// We need to clear the non-client-area region, and the transparent parts
// of the window to black (once).
auto black = reinterpret_cast<HBRUSH>(::GetStockObject(BLACK_BRUSH));
nsAutoRegion regionToClear(ComputeNonClientHRGN());
if (!translucentRegion.IsEmpty()) {
nsAutoRegion translucent(WinUtils::RegionToHRGN(translucentRegion));
::CombineRgn(regionToClear, regionToClear, translucent, RGN_OR);
}
::FillRgn(hDC, regionToClear, black);
}
::FillRgn(hDC, regionToClear, black);
}
mNeedsNCAreaClear = false;