kwin/src/core/renderlayerdelegate.h
Vlad Zahorodnii d2fb4147fc Move multi-purpose code in its own directory
Things such as Output, InputDevice and so on are made to be
multi-purpose. In order to make this separation more clear, this change
moves that code in the core directory. Some things still link to the
abstraction level above (kwin), they can be tackled in future refactors.
Ideally code in core/ should depend either on other code in core/ or
system libs.
2022-09-06 11:21:40 +03:00

67 lines
1.5 KiB
C++

/*
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;
class RenderTarget;
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);
/**
* Returns the repaints schduled for the next frame.
*/
virtual QRegion repaints() const;
/**
* 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.
*/
virtual void paint(RenderTarget *renderTarget, const QRegion &region) = 0;
private:
RenderLayer *m_layer = nullptr;
};
} // namespace KWin