2022-02-04 18:38:37 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "kwin_export.h"
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QRegion>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class RenderLayer;
|
2022-04-12 08:16:27 +00:00
|
|
|
class RenderTarget;
|
2022-02-04 18:38:37 +00:00
|
|
|
class SurfaceItem;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The RenderLayerDelegate class represents a render layer's contents.
|
|
|
|
*/
|
|
|
|
class KWIN_EXPORT RenderLayerDelegate : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit RenderLayerDelegate(QObject *parent = nullptr);
|
|
|
|
|
|
|
|
RenderLayer *layer() const;
|
|
|
|
void setLayer(RenderLayer *layer);
|
|
|
|
|
2022-02-16 17:13:57 +00:00
|
|
|
/**
|
|
|
|
* Returns the repaints schduled for the next frame.
|
|
|
|
*/
|
|
|
|
virtual QRegion repaints() const;
|
|
|
|
|
2022-02-04 18:38:37 +00:00
|
|
|
/**
|
|
|
|
* This function is called by the compositor before starting compositing. Reimplement
|
|
|
|
* this function to do frame initialization.
|
|
|
|
*/
|
|
|
|
virtual void prePaint();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function is called by the compositor after finishing compositing. Reimplement
|
|
|
|
* this function to do post frame cleanup.
|
|
|
|
*/
|
|
|
|
virtual void postPaint();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the direct scanout candidate hint. It can be used to avoid compositing the
|
|
|
|
* render layer.
|
|
|
|
*/
|
|
|
|
virtual SurfaceItem *scanoutCandidate() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function is called when the compositor wants the render layer delegate
|
|
|
|
* to repaint its contents.
|
|
|
|
*/
|
2022-04-12 08:16:27 +00:00
|
|
|
virtual void paint(RenderTarget *renderTarget, const QRegion ®ion) = 0;
|
2022-02-04 18:38:37 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
RenderLayer *m_layer = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace KWin
|