KWin
Loading...
Searching...
No Matches
screentransform.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#pragma once
10
11#include "core/output.h"
12#include "effect/effect.h"
13#include "effect/timeline.h"
14
15namespace KWin
16{
17class GLFramebuffer;
18class GLShader;
19class GLTexture;
20
22{
23 Q_OBJECT
24
25public:
28
29 void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
30 void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::Output *screen) override;
31
32 bool isActive() const override;
33
34 int requestedEffectChainPosition() const override
35 {
36 return 99;
37 }
38 static bool supported();
39
40private:
41 struct Snapshot
42 {
43 std::shared_ptr<GLTexture> texture;
44 std::shared_ptr<GLFramebuffer> framebuffer;
45 };
46
47 struct ScreenState
48 {
49 TimeLine m_timeLine;
50 Snapshot m_prev;
51 Snapshot m_current;
52 QRect m_oldGeometry;
53 OutputTransform m_oldTransform;
54 qreal m_angle = 0;
55 };
56
57 void addScreen(Output *screen);
58 void removeScreen(Output *screen);
59
60 QHash<Output *, ScreenState> m_states;
61
62 std::unique_ptr<GLShader> m_shader;
63 int m_previousTextureLocation = -1;
64 int m_currentTextureLocation = -1;
65 int m_modelViewProjectioMatrixLocation = -1;
66 int m_blendFactorLocation = -1;
67 bool m_capturing = false;
68};
69
70} // namespace KWin
Base class for all KWin effects.
Definition effect.h:535
int requestedEffectChainPosition() const override
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::Output *screen) override
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override
bool isActive() const override