KWin
Loading...
Searching...
No Matches
workspacescene_opengl.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: 2006 Lubos Lunak <l.lunak@kde.org>
6 SPDX-FileCopyrightText: 2009, 2010, 2011 Martin Gräßlin <mgraesslin@kde.org>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10
11#pragma once
12
14
16#include "scene/shadowitem.h"
18
19#include "opengl/glutils.h"
20
21namespace KWin
22{
23class OpenGLBackend;
24
25class KWIN_EXPORT WorkspaceSceneOpenGL : public WorkspaceScene
26{
27 Q_OBJECT
28
29public:
30 explicit WorkspaceSceneOpenGL(OpenGLBackend *backend);
31 ~WorkspaceSceneOpenGL() override;
32
33 bool makeOpenGLContextCurrent() override;
34 void doneOpenGLContextCurrent() override;
35 bool supportsNativeFence() const override;
36 std::unique_ptr<DecorationRenderer> createDecorationRenderer(Decoration::DecoratedClientImpl *impl) override;
37 std::unique_ptr<ShadowTextureProvider> createShadowTextureProvider(Shadow *shadow) override;
38 bool animationsSupported() const override;
39
41 {
42 return m_backend;
43 }
44
45 std::pair<std::shared_ptr<GLTexture>, ColorDescription> textureForOutput(Output *output) const override;
46
47private:
48 OpenGLBackend *m_backend;
49 GLuint vao = 0;
50};
51
59{
60public:
63
65 {
66 return m_texture.get();
67 }
68
69 void update() override;
70
71private:
72 std::shared_ptr<GLTexture> m_texture;
73};
74
76{
77 Q_OBJECT
78public:
79 enum class DecorationPart : int {
80 Left,
81 Top,
82 Right,
83 Bottom,
84 Count
85 };
88
89 void render(const QRegion &region) override;
90
92 {
93 return m_texture.get();
94 }
96 {
97 return m_texture.get();
98 }
99
100private:
101 void renderPart(const QRect &rect, const QRect &partRect, const QPoint &textureOffset, qreal devicePixelRatio, bool rotated = false);
102 static const QMargins texturePadForPart(const QRect &rect, const QRect &partRect);
103 void resizeTexture();
104 int toNativeSize(int size) const;
105 std::unique_ptr<GLTexture> m_texture;
106};
107
108} // namespace
Decoration::DecoratedClientImpl * client() const
The OpenGLBackend creates and holds the OpenGL context and is responsible for Texture from Pixmap.
OpenGL implementation of Shadow.
void render(const QRegion &region) override
SceneOpenGLDecorationRenderer(Decoration::DecoratedClientImpl *client)
Class representing a Window's Shadow to be rendered by the Compositor.
Definition shadow.h:48
Shadow * shadow() const
Definition shadowitem.h:23
OpenGLBackend * backend() const