| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QSGSOFTWARELAYER_H |
| 5 | #define QSGSOFTWARELAYER_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <private/qsgadaptationlayer_p.h> |
| 19 | #include <private/qsgcontext_p.h> |
| 20 | #include <private/qsgtexture_p.h> |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | class QSGSoftwarePixmapRenderer; |
| 25 | |
| 26 | class QSGSoftwareLayer : public QSGLayer |
| 27 | { |
| 28 | Q_OBJECT |
| 29 | public: |
| 30 | QSGSoftwareLayer(QSGRenderContext *renderContext); |
| 31 | ~QSGSoftwareLayer(); |
| 32 | |
| 33 | const QPixmap &pixmap() const { return m_pixmap; } |
| 34 | |
| 35 | // QSGTexture interface |
| 36 | public: |
| 37 | qint64 comparisonKey() const override; |
| 38 | QSize textureSize() const override; |
| 39 | bool hasAlphaChannel() const override; |
| 40 | bool hasMipmaps() const override; |
| 41 | |
| 42 | // QSGDynamicTexture interface |
| 43 | public: |
| 44 | bool updateTexture() override; |
| 45 | |
| 46 | // QSGLayer interface |
| 47 | public: |
| 48 | void setItem(QSGNode *item) override; |
| 49 | void setRect(const QRectF &rect) override; |
| 50 | void setSize(const QSize &size) override; |
| 51 | void scheduleUpdate() override; |
| 52 | QImage toImage() const override; |
| 53 | void setLive(bool live) override; |
| 54 | void setRecursive(bool recursive) override; |
| 55 | void setFormat(Format) override; |
| 56 | void setHasMipmaps(bool) override; |
| 57 | void setDevicePixelRatio(qreal ratio) override; |
| 58 | void setMirrorHorizontal(bool mirror) override; |
| 59 | void setMirrorVertical(bool mirror) override; |
| 60 | void setSamples(int) override { } |
| 61 | |
| 62 | public Q_SLOTS: |
| 63 | void markDirtyTexture() override; |
| 64 | void invalidated() override; |
| 65 | |
| 66 | private: |
| 67 | void grab(); |
| 68 | |
| 69 | QSGNode *m_item; |
| 70 | QSGRenderContext *m_context; |
| 71 | QSGSoftwarePixmapRenderer *m_renderer; |
| 72 | QRectF m_rect; |
| 73 | QSize m_size; |
| 74 | QPixmap m_pixmap; |
| 75 | qreal m_device_pixel_ratio; |
| 76 | bool m_mirrorHorizontal; |
| 77 | bool m_mirrorVertical; |
| 78 | bool m_live; |
| 79 | bool m_grab; |
| 80 | bool m_recursive; |
| 81 | bool m_dirtyTexture; |
| 82 | }; |
| 83 | |
| 84 | QT_END_NAMESPACE |
| 85 | |
| 86 | #endif // QSGSOFTWARELAYER_H |
| 87 | |