mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 15:45:59 +01:00
transformers: allow modifying renderdata pre-pass
This commit is contained in:
parent
a61eb7694d
commit
95db9108e5
3 changed files with 18 additions and 2 deletions
|
@ -412,9 +412,14 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||
|
||||
const bool TRANSFORMERSPRESENT = !pWindow->m_vTransformers.empty();
|
||||
|
||||
if (TRANSFORMERSPRESENT)
|
||||
if (TRANSFORMERSPRESENT) {
|
||||
g_pHyprOpenGL->bindOffMain();
|
||||
|
||||
for (auto& t : pWindow->m_vTransformers) {
|
||||
t->preWindowRender(&renderdata);
|
||||
}
|
||||
}
|
||||
|
||||
if (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL)
|
||||
for (auto& wd : pWindow->m_dWindowDecorations)
|
||||
wd->draw(pMonitor, renderdata.alpha * renderdata.fadeAlpha, offset);
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
#include "Transformer.hpp"
|
||||
#include "Transformer.hpp"
|
||||
|
||||
void IWindowTransformer::preWindowRender(SRenderData* pRenderData) {
|
||||
;
|
||||
}
|
|
@ -2,12 +2,19 @@
|
|||
|
||||
#include "Framebuffer.hpp"
|
||||
|
||||
struct SRenderData;
|
||||
|
||||
// A window transformer can be attached to a window.
|
||||
// If any is attached, Hyprland will render the window to a separate fb, then call the transform() func with it,
|
||||
// and finally render it back to the main fb after all transformers pass.
|
||||
//
|
||||
// Worth noting transformers for now only affect the main pass (not popups)
|
||||
class IWindowTransformer {
|
||||
public:
|
||||
// called by Hyprland. For more data about what is being rendered, inspect render data.
|
||||
// returns the out fb.
|
||||
virtual CFramebuffer* transform(CFramebuffer* in) = 0;
|
||||
|
||||
// called by Hyprland before a window main pass is started.
|
||||
virtual void preWindowRender(SRenderData* pRenderData);
|
||||
};
|
Loading…
Reference in a new issue