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/CHyprGroupBarDecoration.cpp | |
| 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/CHyprGroupBarDecoration.cpp')
| -rw-r--r-- | src/render/decorations/CHyprGroupBarDecoration.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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))); } } |
