diff options
| author | Tom Englund <tomenglund26@gmail.com> | 2025-07-10 10:44:59 +0200 |
|---|---|---|
| committer | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-07-10 14:09:00 +0200 |
| commit | f5af40afce9d453dbf2e5bab739520e1cb80ab12 (patch) | |
| tree | 05d4d51d900e07972c1739c6c20fa3ff07201eaf /src/render/decorations | |
| parent | 6375e471f33bf1a008a005e963c57a12c7ff0e94 (diff) | |
renderpass: use unique ptr instead of shared ptr
lets use unique ptrs instead of refcounting shared ptr when its not
needed, use rvalue reference to construct in vector directly.
Diffstat (limited to 'src/render/decorations')
| -rw-r--r-- | src/render/decorations/CHyprBorderDecoration.cpp | 2 | ||||
| -rw-r--r-- | src/render/decorations/CHyprDropShadowDecoration.cpp | 2 | ||||
| -rw-r--r-- | src/render/decorations/CHyprGroupBarDecoration.cpp | 14 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/render/decorations/CHyprBorderDecoration.cpp b/src/render/decorations/CHyprBorderDecoration.cpp index b34c9243..1ba60f0c 100644 --- a/src/render/decorations/CHyprBorderDecoration.cpp +++ b/src/render/decorations/CHyprBorderDecoration.cpp @@ -89,7 +89,7 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) { data.lerp = m_window->m_borderFadeAnimationProgress->value(); } - g_pHyprRenderer->m_renderPass.add(makeShared<CBorderPassElement>(data)); + g_pHyprRenderer->m_renderPass.add(makeUnique<CBorderPassElement>(data)); } eDecorationType CHyprBorderDecoration::getDecorationType() { diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index ee52b4f4..fa77a343 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -90,7 +90,7 @@ void CHyprDropShadowDecoration::draw(PHLMONITOR pMonitor, float const& a) { CShadowPassElement::SShadowData data; data.deco = this; data.a = a; - g_pHyprRenderer->m_renderPass.add(makeShared<CShadowPassElement>(data)); + g_pHyprRenderer->m_renderPass.add(makeUnique<CShadowPassElement>(data)); } void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) { diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index e577658a..df8731be 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -172,21 +172,21 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { double first = rect.w - (*PROUNDING * 2); rectdata.round = *PROUNDING; rectdata.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}}; - g_pHyprRenderer->m_renderPass.add(makeShared<CRectPassElement>(rectdata)); + g_pHyprRenderer->m_renderPass.add(makeUnique<CRectPassElement>(rectdata)); rectdata.round = 0; rectdata.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}}; } else if (i == barsToDraw - 1) { double first = *PROUNDING * 2; rectdata.round = 0; rectdata.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}}; - g_pHyprRenderer->m_renderPass.add(makeShared<CRectPassElement>(rectdata)); + g_pHyprRenderer->m_renderPass.add(makeUnique<CRectPassElement>(rectdata)); rectdata.round = *PROUNDING; rectdata.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}}; } } else rectdata.round = *PROUNDING; } - g_pHyprRenderer->m_renderPass.add(makeShared<CRectPassElement>(rectdata)); + g_pHyprRenderer->m_renderPass.add(makeUnique<CRectPassElement>(rectdata)); } rect = {ASSIGNEDBOX.x + xoff - pMonitor->m_position.x + m_window->m_floatingOffset.x, @@ -212,21 +212,21 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { double first = rect.w - (*PGRADIENTROUNDING * 2); data.round = *PGRADIENTROUNDING; data.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}}; - g_pHyprRenderer->m_renderPass.add(makeShared<CTexPassElement>(data)); + g_pHyprRenderer->m_renderPass.add(makeUnique<CTexPassElement>(data)); data.round = 0; data.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}}; } else if (i == barsToDraw - 1) { double first = *PGRADIENTROUNDING * 2; data.round = 0; data.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}}; - g_pHyprRenderer->m_renderPass.add(makeShared<CTexPassElement>(data)); + g_pHyprRenderer->m_renderPass.add(makeUnique<CTexPassElement>(data)); data.round = *PGRADIENTROUNDING; data.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}}; } } else data.round = *PGRADIENTROUNDING; } - g_pHyprRenderer->m_renderPass.add(makeShared<CTexPassElement>(data)); + g_pHyprRenderer->m_renderPass.add(makeUnique<CTexPassElement>(data)); } } @@ -256,7 +256,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { data.tex = titleTex; data.box = rect; data.a = a; - g_pHyprRenderer->m_renderPass.add(makeShared<CTexPassElement>(std::move(data))); + g_pHyprRenderer->m_renderPass.add(makeUnique<CTexPassElement>(std::move(data))); } } |
