KWin
Loading...
Searching...
No Matches
regionscreencastsource.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "screencastsource.h"
10
11#include "opengl/gltexture.h"
12#include "opengl/glutils.h"
13#include <QImage>
14
15namespace KWin
16{
17class Output;
18
20{
21 Q_OBJECT
22
23public:
24 explicit RegionScreenCastSource(const QRect &region, qreal scale, QObject *parent = nullptr);
25
26 quint32 drmFormat() const override;
27 bool hasAlphaChannel() const override;
28 QSize textureSize() const override;
29 uint refreshRate() const override;
30
31 void render(GLFramebuffer *target) override;
32 void render(spa_data *spa, spa_video_format format) override;
33 std::chrono::nanoseconds clock() const override;
34
35 QRect region() const
36 {
37 return m_region;
38 }
39 qreal scale() const
40 {
41 return m_scale;
42 }
43 void updateOutput(Output *output);
44
45private:
46 void ensureTexture();
47
48 const QRect m_region;
49 const qreal m_scale;
50 std::unique_ptr<GLFramebuffer> m_target;
51 std::unique_ptr<GLTexture> m_renderedTexture;
52 std::chrono::nanoseconds m_last;
53};
54
55} // namespace KWin
OpenGL framebuffer object.
std::chrono::nanoseconds clock() const override
void render(GLFramebuffer *target) override
RegionScreenCastSource(const QRect &region, qreal scale, QObject *parent=nullptr)
GLenum format
Definition gltexture.cpp:49