renderer: minor fixups for misaligned surface rendering offsets

fixes #5136
This commit is contained in:
Vaxry 2024-03-17 16:08:54 +00:00
parent 3c21f5e07b
commit 30c5911718
2 changed files with 9 additions and 4 deletions

View file

@ -1058,6 +1058,9 @@ bool CWindow::opaque() {
if (m_fAlpha.value() != 1.f || m_fActiveInactiveAlpha.value() != 1.f) if (m_fAlpha.value() != 1.f || m_fActiveInactiveAlpha.value() != 1.f)
return false; return false;
if (m_vRealSize.goal().floor() != m_vReportedSize)
return false;
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
if (m_pWLSurface.small() && !m_pWLSurface.m_bFillIgnoreSmall) if (m_pWLSurface.small() && !m_pWLSurface.m_bFillIgnoreSmall)

View file

@ -92,10 +92,12 @@ static void renderSurface(struct wlr_surface* surface, int x, int y, void* data)
} }
} }
if (!INTERACTIVERESIZEINPROGRESS && PSURFACE && PWINDOW && PWINDOW->m_vRealSize.goal() > PWINDOW->m_vReportedSize && PWINDOW->m_vReportedSize > Vector2D{1, 1}) { if (!INTERACTIVERESIZEINPROGRESS && PSURFACE && PWINDOW && PWINDOW->m_vRealSize.goal().floor() > PWINDOW->m_vReportedSize && PWINDOW->m_vReportedSize > Vector2D{1, 1}) {
Vector2D size = Vector2D coeff = PWINDOW->m_vReportedSize / PWINDOW->m_vRealSize.value();
Vector2D{windowBox.w * (PWINDOW->m_vReportedSize.x / PWINDOW->m_vRealSize.value().x), windowBox.h * (PWINDOW->m_vReportedSize.y / PWINDOW->m_vRealSize.value().y)}; Vector2D coeff2 = PWINDOW->m_vReportedSize / PWINDOW->m_vRealSize.goal();
Vector2D correct = Vector2D{windowBox.w, windowBox.h} - size;
Vector2D size = Vector2D{windowBox.w, windowBox.h} * coeff;
Vector2D correct = Vector2D{windowBox.w, windowBox.h} - Vector2D{windowBox.w, windowBox.h} * coeff2;
windowBox.translate(correct / 2.0); windowBox.translate(correct / 2.0);