diff options
author | Vaxry <[email protected]> | 2024-04-23 12:29:01 +0100 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-04-23 12:29:01 +0100 |
commit | cf3596a96d5c1012c363d8243baca6431ecf835b (patch) | |
tree | e1cb29a743800944aed44504474b289b5f28007e /src/render/Renderer.cpp | |
parent | 4f1214c7e94687a881fece928d1346cf0951b8ee (diff) | |
download | Hyprland-cf3596a96d5c1012c363d8243baca6431ecf835b.tar.gz Hyprland-cf3596a96d5c1012c363d8243baca6431ecf835b.zip |
renderer: avoid rendering frame if finalDamage is empty
Diffstat (limited to 'src/render/Renderer.cpp')
-rw-r--r-- | src/render/Renderer.cpp | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 9a8819e1..9bb75210 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1286,43 +1286,45 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { bool renderCursor = true; - if (!pMonitor->solitaryClient) { - if (pMonitor->isMirror()) { - g_pHyprOpenGL->blend(false); - g_pHyprOpenGL->renderMirrored(); - g_pHyprOpenGL->blend(true); - EMIT_HOOK_EVENT("render", RENDER_POST_MIRROR); - renderCursor = false; - } else { - CBox renderBox = {0, 0, (int)pMonitor->vecPixelSize.x, (int)pMonitor->vecPixelSize.y}; - renderWorkspace(pMonitor, pMonitor->activeWorkspace, &now, renderBox); + if (!finalDamage.empty()) { + if (!pMonitor->solitaryClient) { + if (pMonitor->isMirror()) { + g_pHyprOpenGL->blend(false); + g_pHyprOpenGL->renderMirrored(); + g_pHyprOpenGL->blend(true); + EMIT_HOOK_EVENT("render", RENDER_POST_MIRROR); + renderCursor = false; + } else { + CBox renderBox = {0, 0, (int)pMonitor->vecPixelSize.x, (int)pMonitor->vecPixelSize.y}; + renderWorkspace(pMonitor, pMonitor->activeWorkspace, &now, renderBox); - renderLockscreen(pMonitor, &now, renderBox); + renderLockscreen(pMonitor, &now, renderBox); - if (pMonitor == g_pCompositor->m_pLastMonitor) { - g_pHyprNotificationOverlay->draw(pMonitor); - g_pHyprError->draw(); - } + if (pMonitor == g_pCompositor->m_pLastMonitor) { + g_pHyprNotificationOverlay->draw(pMonitor); + g_pHyprError->draw(); + } - // for drawing the debug overlay - if (pMonitor == g_pCompositor->m_vMonitors.front().get() && *PDEBUGOVERLAY == 1) { - renderStartOverlay = std::chrono::high_resolution_clock::now(); - g_pDebugOverlay->draw(); - endRenderOverlay = std::chrono::high_resolution_clock::now(); - } + // for drawing the debug overlay + if (pMonitor == g_pCompositor->m_vMonitors.front().get() && *PDEBUGOVERLAY == 1) { + renderStartOverlay = std::chrono::high_resolution_clock::now(); + g_pDebugOverlay->draw(); + endRenderOverlay = std::chrono::high_resolution_clock::now(); + } - if (*PDAMAGEBLINK && damageBlinkCleanup == 0) { - CBox monrect = {0, 0, pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y}; - g_pHyprOpenGL->renderRect(&monrect, CColor(1.0, 0.0, 1.0, 100.0 / 255.0), 0); - damageBlinkCleanup = 1; - } else if (*PDAMAGEBLINK) { - damageBlinkCleanup++; - if (damageBlinkCleanup > 3) - damageBlinkCleanup = 0; + if (*PDAMAGEBLINK && damageBlinkCleanup == 0) { + CBox monrect = {0, 0, pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y}; + g_pHyprOpenGL->renderRect(&monrect, CColor(1.0, 0.0, 1.0, 100.0 / 255.0), 0); + damageBlinkCleanup = 1; + } else if (*PDAMAGEBLINK) { + damageBlinkCleanup++; + if (damageBlinkCleanup > 3) + damageBlinkCleanup = 0; + } } + } else { + g_pHyprRenderer->renderWindow(pMonitor->solitaryClient, pMonitor, &now, false, RENDER_PASS_MAIN /* solitary = no popups */); } - } else { - g_pHyprRenderer->renderWindow(pMonitor->solitaryClient, pMonitor, &now, false, RENDER_PASS_MAIN /* solitary = no popups */); } renderCursor = renderCursor && shouldRenderCursor(); |