diff options
| author | UjinT34 <41110182+UjinT34@users.noreply.github.com> | 2026-03-29 00:41:45 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-28 21:41:45 +0000 |
| commit | 38a7f03cf0e5ee116794a78581634ba3dab508fa (patch) | |
| tree | 969891411b2af4e437a183004018cfc359a3057e /src/render/pass/Pass.cpp | |
| parent | ef2e8dfd5f7e6ee55fa7bc48e44974e64938d14a (diff) | |
renderer: refactor part 7: api fixes (#13631)
Part 7 of ujin's refactors
---------
Co-authored-by: Vaxry <vaxry@vaxry.net>
Diffstat (limited to 'src/render/pass/Pass.cpp')
| -rw-r--r-- | src/render/pass/Pass.cpp | 71 |
1 files changed, 32 insertions, 39 deletions
diff --git a/src/render/pass/Pass.cpp b/src/render/pass/Pass.cpp index cbf6ea48..a097fd59 100644 --- a/src/render/pass/Pass.cpp +++ b/src/render/pass/Pass.cpp @@ -10,6 +10,10 @@ #include "../../render/Renderer.hpp" #include "../../desktop/state/FocusState.hpp" #include "../../protocols/core/Compositor.hpp" +#include "RectPassElement.hpp" +#include "macros.hpp" + +using namespace Render; bool CRenderPass::empty() const { return false; @@ -213,15 +217,10 @@ void CRenderPass::renderDebugData() { const auto pMonitor = g_pHyprRenderer->m_renderData.pMonitor; CBox box = {{}, pMonitor->m_transformedSize}; for (const auto& rg : m_occludedRegions) { - CRectPassElement::SRectData data; - data.box = box; - data.color = Colors::RED.modifyA(0.1F); - g_pHyprRenderer->draw(makeUnique<CRectPassElement>(data), rg); + g_pHyprRenderer->draw(CRectPassElement::SRectData{.box = box, .color = Colors::RED.modifyA(0.1F)}, rg); } - CRectPassElement::SRectData data; - data.box = box; - data.color = Colors::GREEN.modifyA(0.1F); - g_pHyprRenderer->draw(makeUnique<CRectPassElement>(data), m_totalLiveBlurRegion); + + g_pHyprRenderer->draw(CRectPassElement::SRectData{.box = box, .color = Colors::GREEN.modifyA(0.1F)}, m_totalLiveBlurRegion); std::unordered_map<CWLSurfaceResource*, float> offsets; @@ -244,10 +243,7 @@ void CRenderPass::renderDebugData() { if (box.intersection(CBox{{}, pMonitor->m_size}).empty()) return; - CRectPassElement::SRectData data; - data.box = box; - data.color = color; - g_pHyprRenderer->draw(makeUnique<CRectPassElement>(data), m_damage); + g_pHyprRenderer->draw(CRectPassElement::SRectData{.box = box, .color = color}, m_damage); if (offsets.contains(surface.get())) box.translate(Vector2D{0.F, offsets[surface.get()]}); @@ -255,16 +251,16 @@ void CRenderPass::renderDebugData() { offsets[surface.get()] = 0; box = {box.pos(), texture->m_size}; - CRectPassElement::SRectData data2; - data.box = box; - data.color = color; - data.round = std::min(5.0, box.size().y); - g_pHyprRenderer->draw(makeUnique<CRectPassElement>(data2), m_damage); - CTexPassElement::SRenderData texData; - texData.tex = texture; - texData.box = box; - g_pHyprRenderer->draw(makeUnique<CTexPassElement>(texData), m_damage); + g_pHyprRenderer->draw( + CRectPassElement::SRectData{ + .box = box, + .color = color, + .round = std::min(5.0, box.size().y), + }, + m_damage); + + g_pHyprRenderer->draw(CTexPassElement::SRenderData{.tex = texture, .box = box}, m_damage); offsets[surface.get()] += texture->m_size.y; }; @@ -281,10 +277,7 @@ void CRenderPass::renderDebugData() { if (hlSurface) { auto BOX = hlSurface->getSurfaceBoxGlobal(); if (BOX) { - CRectPassElement::SRectData data; - data.box = box; - data.color = CHyprColor{0.8F, 0.8F, 0.2F, 0.4F}; - g_pHyprRenderer->draw(makeUnique<CRectPassElement>(data), m_damage); + g_pHyprRenderer->draw(CRectPassElement::SRectData{.box = box, .color = CHyprColor{0.8F, 0.8F, 0.2F, 0.4F}}, m_damage); } } } @@ -295,13 +288,13 @@ void CRenderPass::renderDebugData() { DISCARDED_ELEMENTS, pMonitor->m_pixelSize), Colors::WHITE, 12); - if (tex) { - box = CBox{{0.F, pMonitor->m_size.y - tex->m_size.y}, tex->m_size}.scale(pMonitor->m_scale); - CTexPassElement::SRenderData texData; - texData.tex = tex; - texData.box = box; - g_pHyprRenderer->draw(makeUnique<CTexPassElement>(texData), m_damage); - } + if (tex) + g_pHyprRenderer->draw( + CTexPassElement::SRenderData{ + .tex = tex, + .box = CBox{{0.F, pMonitor->m_size.y - tex->m_size.y}, tex->m_size}.scale(pMonitor->m_scale), + }, + m_damage); std::string passStructure; auto yn = [](const bool val) -> const char* { return val ? "yes" : "no"; }; @@ -315,13 +308,13 @@ void CRenderPass::renderDebugData() { passStructure.pop_back(); tex = g_pHyprRenderer->renderText(passStructure, Colors::WHITE, 12); - if (tex) { - box = CBox{{pMonitor->m_size.x - tex->m_size.x, pMonitor->m_size.y - tex->m_size.y}, tex->m_size}.scale(pMonitor->m_scale); - CTexPassElement::SRenderData texData; - texData.tex = tex; - texData.box = box; - g_pHyprRenderer->draw(makeUnique<CTexPassElement>(texData), m_damage); - } + if (tex) + g_pHyprRenderer->draw( + CTexPassElement::SRenderData{ + .tex = tex, + .box = CBox{{pMonitor->m_size.x - tex->m_size.x, pMonitor->m_size.y - tex->m_size.y}, tex->m_size}.scale(pMonitor->m_scale), + }, + m_damage); } float CRenderPass::oneBlurRadius() { |
