kwin/src/rendertarget.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

40 lines
710 B
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 <QImage>
#include <variant>
namespace KWin
{
class GLFramebuffer;
class KWIN_EXPORT RenderTarget
{
public:
RenderTarget();
explicit RenderTarget(GLFramebuffer *fbo);
explicit RenderTarget(QImage *image);
QSize size() const;
using NativeHandle = std::variant<GLFramebuffer *, QImage *>;
NativeHandle nativeHandle() const;
void setDevicePixelRatio(qreal ratio);
qreal devicePixelRatio() const;
private:
NativeHandle m_nativeHandle;
qreal m_devicePixelRatio = 1;
};
} // namespace KWin