kwin/src/outputlayer.h
Vlad Zahorodnii bfb60e3610 Add RenderTarget type
The main motivation behind this change is to unify render target
representation across opengl and software renderers and avoid accessing
the render backend directory in order to get the render target.
2022-04-13 10:16:16 +00:00

56 lines
1.2 KiB
C++

/*
SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "kwin_export.h"
#include "rendertarget.h"
#include <QObject>
#include <QRegion>
namespace KWin
{
class SurfaceItem;
struct OutputLayerBeginFrameInfo
{
RenderTarget renderTarget;
QRegion repaint;
};
class KWIN_EXPORT OutputLayer : public QObject
{
Q_OBJECT
public:
explicit OutputLayer(QObject *parent = nullptr);
QRegion repaints() const;
void resetRepaints();
void addRepaint(const QRegion &region);
/**
* Notifies about starting to paint.
*
* @p damage contains the reported damage as suggested by windows and effects on prepaint calls.
*/
virtual void aboutToStartPainting(const QRegion &damage);
virtual OutputLayerBeginFrameInfo beginFrame() = 0;
virtual void endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) = 0;
/**
* Tries to import the newest buffer of the surface for direct scanout
* Returns @c true if scanout succeeds, @c false if rendering is necessary
*/
virtual bool scanout(SurfaceItem *surfaceItem);
private:
QRegion m_repaints;
};
} // namespace KWin