File indexing completed on 2025-01-19 13:53:21
0001 /* 0002 SPDX-FileCopyrightText: 2021 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 <QRegion> 0012 0013 namespace KWin 0014 { 0015 0016 class RenderLayer; 0017 class RenderTarget; 0018 class SurfaceItem; 0019 0020 /** 0021 * The RenderLayerDelegate class represents a render layer's contents. 0022 */ 0023 class KWIN_EXPORT RenderLayerDelegate 0024 { 0025 public: 0026 virtual ~RenderLayerDelegate() = default; 0027 0028 RenderLayer *layer() const; 0029 void setLayer(RenderLayer *layer); 0030 0031 /** 0032 * Returns the repaints schduled for the next frame. 0033 */ 0034 virtual QRegion repaints() const; 0035 0036 /** 0037 * This function is called by the compositor before starting compositing. Reimplement 0038 * this function to do frame initialization. 0039 */ 0040 virtual void prePaint(); 0041 0042 /** 0043 * This function is called by the compositor after finishing compositing. Reimplement 0044 * this function to do post frame cleanup. 0045 */ 0046 virtual void postPaint(); 0047 0048 /** 0049 * Returns the direct scanout candidate hint. It can be used to avoid compositing the 0050 * render layer. 0051 */ 0052 virtual SurfaceItem *scanoutCandidate() const; 0053 0054 /** 0055 * This function is called when the compositor wants the render layer delegate 0056 * to repaint its contents. 0057 */ 0058 virtual void paint(RenderTarget *renderTarget, const QRegion ®ion) = 0; 0059 0060 private: 0061 RenderLayer *m_layer = nullptr; 0062 }; 0063 0064 } // namespace KWin