KWin
Loading...
Searching...
No Matches
outputlayer.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "core/rendertarget.h"
10#include "kwin_export.h"
11
12#include <QObject>
13#include <QRegion>
14#include <chrono>
15#include <optional>
16
17namespace KWin
18{
19
20class SurfaceItem;
21
27
28class KWIN_EXPORT OutputLayer : public QObject
29{
30 Q_OBJECT
31public:
32 explicit OutputLayer(QObject *parent = nullptr);
33
34 qreal scale() const;
35 void setScale(qreal scale);
36
37 QPointF hotspot() const;
38 void setHotspot(const QPointF &hotspot);
39
40 QSizeF size() const;
41 void setSize(const QSizeF &size);
46 virtual std::optional<QSize> fixedSize() const;
47
48 QRegion repaints() const;
49 void resetRepaints();
50 void addRepaint(const QRegion &region);
51 bool needsRepaint() const;
52
56 void setPosition(const QPointF &position);
57 QPointF position() const;
58
62 void setEnabled(bool enable);
63 bool isEnabled() const;
64
65 virtual std::optional<OutputLayerBeginFrameInfo> beginFrame() = 0;
66 virtual bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) = 0;
67
72 virtual bool scanout(SurfaceItem *surfaceItem);
73
77 virtual std::chrono::nanoseconds queryRenderTime() const = 0;
78
79private:
80 QRegion m_repaints;
81 QPointF m_hotspot;
82 QPointF m_position;
83 QSizeF m_size;
84 qreal m_scale = 1.0;
85 bool m_enabled = false;
86};
87
88} // namespace KWin
virtual bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)=0
virtual std::chrono::nanoseconds queryRenderTime() const =0
virtual std::optional< OutputLayerBeginFrameInfo > beginFrame()=0