summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Renderer.cpp55
-rw-r--r--src/render/decorations/CHyprBorderDecoration.cpp2
-rw-r--r--src/render/decorations/CHyprBorderDecoration.hpp2
-rw-r--r--src/render/decorations/CHyprDropShadowDecoration.cpp2
-rw-r--r--src/render/decorations/CHyprDropShadowDecoration.hpp2
-rw-r--r--src/render/decorations/CHyprGroupBarDecoration.cpp2
-rw-r--r--src/render/decorations/CHyprGroupBarDecoration.hpp2
-rw-r--r--src/render/decorations/IHyprWindowDecoration.hpp2
8 files changed, 36 insertions, 33 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 1c38eb4e..1dedcc7d 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -158,9 +158,7 @@ static void renderSurface(SP<CWLSurfaceResource> surface, int x, int y, void* da
if (!surface->current.texture)
return;
- const auto& TEXTURE = surface->current.texture;
- const auto RDATA = (SRenderData*)data;
- const auto INTERACTIVERESIZEINPROGRESS = RDATA->pWindow && g_pInputManager->currentlyDraggedWindow && g_pInputManager->dragMode == MBIND_RESIZE;
+ const auto& TEXTURE = surface->current.texture;
// this is bad, probably has been logged elsewhere. Means the texture failed
// uploading to the GPU.
@@ -175,6 +173,8 @@ static void renderSurface(SP<CWLSurfaceResource> surface, int x, int y, void* da
}
}
+ const auto RDATA = (SRenderData*)data;
+ const auto INTERACTIVERESIZEINPROGRESS = RDATA->pWindow && g_pInputManager->currentlyDraggedWindow && g_pInputManager->dragMode == MBIND_RESIZE;
TRACY_GPU_ZONE("RenderSurface");
double outputX = -RDATA->pMonitor->vecPosition.x, outputY = -RDATA->pMonitor->vecPosition.y;
@@ -484,36 +484,43 @@ void CHyprRenderer::renderWorkspaceWindows(PHLMONITOR pMonitor, PHLWORKSPACE pWo
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
- // Non-floating main
+ std::vector<PHLWINDOWREF> windows;
+ windows.reserve(g_pCompositor->m_vWindows.size());
+
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut))
continue;
- if (w->m_bIsFloating)
- continue; // floating are in the second pass
-
if (!shouldRenderWindow(w, pMonitor))
continue;
+ windows.push_back(w);
+ }
+
+ // Non-floating main
+ for (auto& w : windows) {
+ if (w->m_bIsFloating)
+ continue; // floating are in the second pass
+
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
continue;
// render active window after all others of this pass
if (w == g_pCompositor->m_pLastWindow) {
- lastWindow = w;
+ lastWindow = w.lock();
continue;
}
// render the bad boy
- renderWindow(w, pMonitor, time, true, RENDER_PASS_MAIN);
+ renderWindow(w.lock(), pMonitor, time, true, RENDER_PASS_MAIN);
}
if (lastWindow)
renderWindow(lastWindow, pMonitor, time, true, RENDER_PASS_MAIN);
// Non-floating popup
- for (auto const& w : g_pCompositor->m_vWindows) {
- if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut))
+ for (auto& w : windows) {
+ if (!w)
continue;
if (w->m_bIsFloating)
@@ -522,24 +529,19 @@ void CHyprRenderer::renderWorkspaceWindows(PHLMONITOR pMonitor, PHLWORKSPACE pWo
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
continue;
- if (!shouldRenderWindow(w, pMonitor))
- continue;
-
// render the bad boy
- renderWindow(w, pMonitor, time, true, RENDER_PASS_POPUP);
+ renderWindow(w.lock(), pMonitor, time, true, RENDER_PASS_POPUP);
+ w.reset();
}
// floating on top
- for (auto const& w : g_pCompositor->m_vWindows) {
- if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut))
+ for (auto& w : windows) {
+ if (!w)
continue;
if (!w->m_bIsFloating || w->m_bPinned)
continue;
- if (!shouldRenderWindow(w, pMonitor))
- continue;
-
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
continue;
@@ -547,7 +549,7 @@ void CHyprRenderer::renderWorkspaceWindows(PHLMONITOR pMonitor, PHLWORKSPACE pWo
continue; // special on another are rendered as a part of the base pass
// render the bad boy
- renderWindow(w, pMonitor, time, true, RENDER_PASS_ALL);
+ renderWindow(w.lock(), pMonitor, time, true, RENDER_PASS_ALL);
}
}
@@ -1093,8 +1095,8 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
if (pSurface->current.viewport.hasSource) {
// we stretch it to dest. if no dest, to 1,1
- Vector2D bufferSize = pSurface->current.bufferSize;
- auto bufferSource = pSurface->current.viewport.source;
+ Vector2D const& bufferSize = pSurface->current.bufferSize;
+ auto const& bufferSource = pSurface->current.viewport.source;
// calculate UV for the basic src_box. Assume dest == size. Scale to dest later
uvTL = Vector2D(bufferSource.x / bufferSize.x, bufferSource.y / bufferSize.y);
@@ -1904,10 +1906,11 @@ void CHyprRenderer::damageBox(CBox* pBox, bool skipFrameSchedule) {
if (m->isMirror())
continue; // don't damage mirrors traditionally
- CBox damageBox = {pBox->x - m->vecPosition.x, pBox->y - m->vecPosition.y, pBox->width, pBox->height};
- damageBox.scale(m->scale);
- if (!skipFrameSchedule)
+ if (!skipFrameSchedule) {
+ CBox damageBox = {pBox->x - m->vecPosition.x, pBox->y - m->vecPosition.y, pBox->width, pBox->height};
+ damageBox.scale(m->scale);
m->addDamage(&damageBox);
+ }
}
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
diff --git a/src/render/decorations/CHyprBorderDecoration.cpp b/src/render/decorations/CHyprBorderDecoration.cpp
index 68325a9c..d62e67c4 100644
--- a/src/render/decorations/CHyprBorderDecoration.cpp
+++ b/src/render/decorations/CHyprBorderDecoration.cpp
@@ -46,7 +46,7 @@ CBox CHyprBorderDecoration::assignedBoxGlobal() {
return box.translate(WORKSPACEOFFSET);
}
-void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float a) {
+void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) {
if (doesntWantBorders())
return;
diff --git a/src/render/decorations/CHyprBorderDecoration.hpp b/src/render/decorations/CHyprBorderDecoration.hpp
index 5d248a81..bc9d7836 100644
--- a/src/render/decorations/CHyprBorderDecoration.hpp
+++ b/src/render/decorations/CHyprBorderDecoration.hpp
@@ -11,7 +11,7 @@ class CHyprBorderDecoration : public IHyprWindowDecoration {
virtual void onPositioningReply(const SDecorationPositioningReply& reply);
- virtual void draw(PHLMONITOR, float a);
+ virtual void draw(PHLMONITOR, float const& a);
virtual eDecorationType getDecorationType();
diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp
index a4388a67..79d5940b 100644
--- a/src/render/decorations/CHyprDropShadowDecoration.cpp
+++ b/src/render/decorations/CHyprDropShadowDecoration.cpp
@@ -86,7 +86,7 @@ void CHyprDropShadowDecoration::updateWindow(PHLWINDOW pWindow) {
m_bLastWindowBoxWithDecos = g_pDecorationPositioner->getBoxWithIncludedDecos(pWindow);
}
-void CHyprDropShadowDecoration::draw(PHLMONITOR pMonitor, float a) {
+void CHyprDropShadowDecoration::draw(PHLMONITOR pMonitor, float const& a) {
const auto PWINDOW = m_pWindow.lock();
diff --git a/src/render/decorations/CHyprDropShadowDecoration.hpp b/src/render/decorations/CHyprDropShadowDecoration.hpp
index fce9a7c7..8335cde9 100644
--- a/src/render/decorations/CHyprDropShadowDecoration.hpp
+++ b/src/render/decorations/CHyprDropShadowDecoration.hpp
@@ -11,7 +11,7 @@ class CHyprDropShadowDecoration : public IHyprWindowDecoration {
virtual void onPositioningReply(const SDecorationPositioningReply& reply);
- virtual void draw(PHLMONITOR, float a);
+ virtual void draw(PHLMONITOR, float const& a);
virtual eDecorationType getDecorationType();
diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp
index c9f812d7..ec9f876b 100644
--- a/src/render/decorations/CHyprGroupBarDecoration.cpp
+++ b/src/render/decorations/CHyprGroupBarDecoration.cpp
@@ -94,7 +94,7 @@ void CHyprGroupBarDecoration::damageEntire() {
g_pHyprRenderer->damageBox(&box);
}
-void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float a) {
+void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
// get how many bars we will draw
int barsToDraw = m_dwGroupMembers.size();
diff --git a/src/render/decorations/CHyprGroupBarDecoration.hpp b/src/render/decorations/CHyprGroupBarDecoration.hpp
index e388fa38..338a8449 100644
--- a/src/render/decorations/CHyprGroupBarDecoration.hpp
+++ b/src/render/decorations/CHyprGroupBarDecoration.hpp
@@ -31,7 +31,7 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
virtual void onPositioningReply(const SDecorationPositioningReply& reply);
- virtual void draw(PHLMONITOR, float a);
+ virtual void draw(PHLMONITOR, float const& a);
virtual eDecorationType getDecorationType();
diff --git a/src/render/decorations/IHyprWindowDecoration.hpp b/src/render/decorations/IHyprWindowDecoration.hpp
index 99698a56..d6d57902 100644
--- a/src/render/decorations/IHyprWindowDecoration.hpp
+++ b/src/render/decorations/IHyprWindowDecoration.hpp
@@ -39,7 +39,7 @@ class IHyprWindowDecoration {
virtual void onPositioningReply(const SDecorationPositioningReply& reply) = 0;
- virtual void draw(PHLMONITOR, float a) = 0;
+ virtual void draw(PHLMONITOR, float const& a) = 0;
virtual eDecorationType getDecorationType() = 0;