File indexing completed on 2024-05-12 05:31:45
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #pragma once 0010 0011 #include "core/renderbackend.h" 0012 0013 #include <memory> 0014 0015 class QImage; 0016 class QRegion; 0017 class QSize; 0018 class QString; 0019 0020 namespace KWin 0021 { 0022 0023 class Output; 0024 0025 class KWIN_EXPORT QPainterBackend : public RenderBackend 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 virtual ~QPainterBackend(); 0031 0032 CompositingType compositingType() const override final; 0033 0034 std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmap *pixmap) override; 0035 0036 /** 0037 * @brief Whether the creation of the Backend failed. 0038 * 0039 * The SceneQPainter should test whether the Backend got constructed correctly. If this method 0040 * returns @c true, the SceneQPainter should not try to start the rendering. 0041 * 0042 * @return bool @c true if the creation of the Backend failed, @c false otherwise. 0043 */ 0044 bool isFailed() const 0045 { 0046 return m_failed; 0047 } 0048 0049 protected: 0050 QPainterBackend(); 0051 /** 0052 * @brief Sets the backend initialization to failed. 0053 * 0054 * This method should be called by the concrete subclass in case the initialization failed. 0055 * The given @p reason is logged as a warning. 0056 * 0057 * @param reason The reason why the initialization failed. 0058 */ 0059 void setFailed(const QString &reason); 0060 0061 private: 0062 bool m_failed; 0063 }; 0064 0065 } // KWin