File indexing completed on 2024-12-01 13:36:10
0001 /* 0002 SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kwin_export.h" 0010 0011 #include <QImage> 0012 0013 #include <variant> 0014 0015 namespace KWin 0016 { 0017 0018 class GLFramebuffer; 0019 0020 class KWIN_EXPORT RenderTarget 0021 { 0022 public: 0023 RenderTarget(); 0024 explicit RenderTarget(GLFramebuffer *fbo); 0025 explicit RenderTarget(QImage *image); 0026 0027 QSize size() const; 0028 0029 using NativeHandle = std::variant<GLFramebuffer *, QImage *>; 0030 NativeHandle nativeHandle() const; 0031 0032 void setDevicePixelRatio(qreal ratio); 0033 qreal devicePixelRatio() const; 0034 0035 private: 0036 NativeHandle m_nativeHandle; 0037 qreal m_devicePixelRatio = 1; 0038 }; 0039 0040 } // namespace KWin