border: fix failed assert on small windows

fixes #4115
This commit is contained in:
Vaxry 2023-12-10 19:32:03 +00:00
parent d02ba422da
commit 167f2ed3b2

View file

@ -51,6 +51,11 @@ void CHyprBorderDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& of
if (m_bAssignedGeometry.width < m_seExtents.topLeft.x + 1 || m_bAssignedGeometry.height < m_seExtents.topLeft.y + 1) if (m_bAssignedGeometry.width < m_seExtents.topLeft.x + 1 || m_bAssignedGeometry.height < m_seExtents.topLeft.y + 1)
return; return;
CBox windowBox = assignedBoxGlobal().translate(-pMonitor->vecPosition).expand(-m_pWindow->getRealBorderSize()).scale(pMonitor->scale).round();
if (windowBox.width < 1 || windowBox.height < 1)
return;
auto grad = m_pWindow->m_cRealBorderColor; auto grad = m_pWindow->m_cRealBorderColor;
const bool ANIMATED = m_pWindow->m_fBorderFadeAnimationProgress.isBeingAnimated(); const bool ANIMATED = m_pWindow->m_fBorderFadeAnimationProgress.isBeingAnimated();
float a1 = a * (ANIMATED ? m_pWindow->m_fBorderFadeAnimationProgress.fl() : 1.f); float a1 = a * (ANIMATED ? m_pWindow->m_fBorderFadeAnimationProgress.fl() : 1.f);
@ -60,8 +65,6 @@ void CHyprBorderDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& of
grad.m_fAngle = normalizeAngleRad(grad.m_fAngle); grad.m_fAngle = normalizeAngleRad(grad.m_fAngle);
} }
CBox windowBox = assignedBoxGlobal().translate(-pMonitor->vecPosition).expand(-m_pWindow->getRealBorderSize()).scale(pMonitor->scale).round();
int borderSize = m_pWindow->getRealBorderSize(); int borderSize = m_pWindow->getRealBorderSize();
const auto ROUNDING = m_pWindow->rounding() * pMonitor->scale; const auto ROUNDING = m_pWindow->rounding() * pMonitor->scale;