3
0
mirror of https://github.com/hyprwm/Hyprland.git synced 2025-11-01 16:16:41 +00:00

renderer: fix inconsistent border thickness for roundingPower < 2 (#11752)

This commit is contained in:
REVO9 2025-09-19 00:34:54 +02:00 committed by Vaxry
parent e837773ce0
commit 5d551fe17a
No known key found for this signature in database
GPG Key ID: 665806380871D640
2 changed files with 14 additions and 8 deletions

View File

@ -70,14 +70,18 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) {
m_window->m_realBorderColorPrevious.m_angle = grad.m_angle;
}
int borderSize = m_window->getRealBorderSize();
const auto ROUNDING = m_window->rounding() * pMonitor->m_scale;
const auto ROUNDINGPOWER = m_window->roundingPower();
int borderSize = m_window->getRealBorderSize();
const auto ROUNDINGBASE = m_window->rounding();
const auto ROUNDING = ROUNDINGBASE * pMonitor->m_scale;
const auto ROUNDINGPOWER = m_window->roundingPower();
const auto CORRECTIONOFFSET = (borderSize * (M_SQRT2 - 1) * std::max(2.0 - ROUNDINGPOWER, 0.0));
const auto OUTERROUND = ((ROUNDINGBASE + borderSize) - CORRECTIONOFFSET) * pMonitor->m_scale;
CBorderPassElement::SBorderData data;
data.box = windowBox;
data.grad1 = grad;
data.round = ROUNDING;
data.outerRound = OUTERROUND;
data.roundingPower = ROUNDINGPOWER;
data.a = a;
data.borderSize = borderSize;

View File

@ -117,11 +117,13 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
if (*PSHADOWS != 1)
return; // disabled
const auto ROUNDINGBASE = PWINDOW->rounding();
const auto ROUNDINGPOWER = PWINDOW->roundingPower();
const auto ROUNDING = ROUNDINGBASE > 0 ? ROUNDINGBASE + PWINDOW->getRealBorderSize() : 0;
const auto PWORKSPACE = PWINDOW->m_workspace;
const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_pinned ? PWORKSPACE->m_renderOffset->value() : Vector2D();
const auto BORDERSIZE = PWINDOW->getRealBorderSize();
const auto ROUNDINGBASE = PWINDOW->rounding();
const auto ROUNDINGPOWER = PWINDOW->roundingPower();
const auto CORRECTIONOFFSET = (BORDERSIZE * (M_SQRT2 - 1) * std::max(2.0 - ROUNDINGPOWER, 0.0));
const auto ROUNDING = ROUNDINGBASE > 0 ? (ROUNDINGBASE + BORDERSIZE) - CORRECTIONOFFSET : 0;
const auto PWORKSPACE = PWINDOW->m_workspace;
const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_pinned ? PWORKSPACE->m_renderOffset->value() : Vector2D();
// draw the shadow
CBox fullBox = m_lastWindowBoxWithDecos;