KWin
Loading...
Searching...
No Matches
openglsurfacetexture.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "scene/surfaceitem.h"
10
11namespace KWin
12{
13
14class GLShader;
15class GLTexture;
16class OpenGLBackend;
17
18class KWIN_EXPORT OpenGLSurfaceContents
19{
20public:
24 OpenGLSurfaceContents(const std::shared_ptr<GLTexture> &contents)
25 : planes({contents})
26 {
27 }
28 OpenGLSurfaceContents(const QList<std::shared_ptr<GLTexture>> &planes)
29 : planes(planes)
30 {
31 }
32
33 void setDirty();
34 void reset()
35 {
36 planes.clear();
37 }
38 bool isValid() const
39 {
40 return !planes.isEmpty();
41 }
42
43 QList<std::shared_ptr<GLTexture>> planes;
44};
45
46class KWIN_EXPORT OpenGLSurfaceTexture : public SurfaceTexture
47{
48public:
49 explicit OpenGLSurfaceTexture(OpenGLBackend *backend);
50 ~OpenGLSurfaceTexture() override;
51
52 bool isValid() const override;
53
54 OpenGLBackend *backend() const;
55 OpenGLSurfaceContents texture() const;
56
57 virtual bool create() = 0;
58 virtual void update(const QRegion &region) = 0;
59
60protected:
63};
64
65} // namespace KWin
The OpenGLBackend creates and holds the OpenGL context and is responsible for Texture from Pixmap.
OpenGLSurfaceContents(const std::shared_ptr< GLTexture > &contents)
OpenGLSurfaceContents(const QList< std::shared_ptr< GLTexture > > &planes)
QList< std::shared_ptr< GLTexture > > planes
OpenGLSurfaceContents m_texture
virtual bool create()=0
virtual void update(const QRegion &region)=0