File indexing completed on 2024-05-19 16:34:45
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 <QMatrix4x4> 0012 0013 class QPainter; 0014 0015 namespace KWin 0016 { 0017 0018 class ImageItem; 0019 class Item; 0020 class RenderTarget; 0021 class Scene; 0022 class WindowPaintData; 0023 0024 class KWIN_EXPORT ItemRenderer 0025 { 0026 public: 0027 ItemRenderer(); 0028 virtual ~ItemRenderer(); 0029 0030 QMatrix4x4 renderTargetProjectionMatrix() const; 0031 QRect renderTargetRect() const; 0032 void setRenderTargetRect(const QRectF &rect); 0033 qreal renderTargetScale() const; 0034 void setRenderTargetScale(qreal scale); 0035 0036 QRegion mapToRenderTarget(const QRegion ®ion) const; 0037 virtual QPainter *painter() const; 0038 0039 virtual void beginFrame(RenderTarget *renderTarget); 0040 virtual void endFrame(); 0041 0042 virtual void renderBackground(const QRegion ®ion) = 0; 0043 virtual void renderItem(Item *item, int mask, const QRegion ®ion, const WindowPaintData &data) = 0; 0044 0045 virtual ImageItem *createImageItem(Scene *scene, Item *parent = nullptr) = 0; 0046 0047 protected: 0048 QMatrix4x4 m_renderTargetProjectionMatrix; 0049 QRectF m_renderTargetRect; 0050 qreal m_renderTargetScale = 1; 0051 }; 0052 0053 } // namespace KWin