File indexing completed on 2024-05-19 16:34:49
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 "qpainterbackend.h" 0012 0013 #include "scene/decorationitem.h" 0014 #include "scene/workspacescene.h" 0015 #include "shadow.h" 0016 0017 namespace KWin 0018 { 0019 0020 class KWIN_EXPORT WorkspaceSceneQPainter : public WorkspaceScene 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 explicit WorkspaceSceneQPainter(QPainterBackend *backend); 0026 ~WorkspaceSceneQPainter() override; 0027 0028 std::unique_ptr<Shadow> createShadow(Window *window) override; 0029 DecorationRenderer *createDecorationRenderer(Decoration::DecoratedClientImpl *impl) override; 0030 0031 bool animationsSupported() const override 0032 { 0033 return false; 0034 } 0035 0036 QPainterBackend *backend() const 0037 { 0038 return m_backend; 0039 } 0040 0041 private: 0042 QPainterBackend *m_backend; 0043 }; 0044 0045 class SceneQPainterShadow : public Shadow 0046 { 0047 public: 0048 SceneQPainterShadow(Window *window); 0049 ~SceneQPainterShadow() override; 0050 0051 protected: 0052 bool prepareBackend() override; 0053 }; 0054 0055 class SceneQPainterDecorationRenderer : public DecorationRenderer 0056 { 0057 Q_OBJECT 0058 public: 0059 enum class DecorationPart : int { 0060 Left, 0061 Top, 0062 Right, 0063 Bottom, 0064 Count 0065 }; 0066 explicit SceneQPainterDecorationRenderer(Decoration::DecoratedClientImpl *client); 0067 0068 void render(const QRegion ®ion) override; 0069 0070 QImage image(DecorationPart part) const; 0071 0072 private: 0073 void resizeImages(); 0074 QImage m_images[int(DecorationPart::Count)]; 0075 }; 0076 0077 } // KWin