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 QPLATFORMSHAREDGRAPHICSCACHE_H |
5 | #define QPLATFORMSHAREDGRAPHICSCACHE_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is part of the QPA API and is not meant to be used |
12 | // in applications. Usage of this API may make your code |
13 | // source and binary incompatible with future versions of Qt. |
14 | // |
15 | |
16 | #include <QtGui/qtguiglobal.h> |
17 | #include <QtCore/qobject.h> |
18 | #include <QtGui/qimage.h> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class Q_GUI_EXPORT QPlatformSharedGraphicsCache: public QObject |
23 | { |
24 | Q_OBJECT |
25 | public: |
26 | enum PixelFormat |
27 | { |
28 | Alpha8 |
29 | }; |
30 | |
31 | enum BufferType |
32 | { |
33 | OpenGLTexture |
34 | }; |
35 | |
36 | explicit QPlatformSharedGraphicsCache(QObject *parent = nullptr) : QObject(parent) {} |
37 | |
38 | virtual void beginRequestBatch() = 0; |
39 | virtual void ensureCacheInitialized(const QByteArray &cacheId, BufferType bufferType, |
40 | PixelFormat pixelFormat) = 0; |
41 | virtual void requestItems(const QByteArray &cacheId, const QList<quint32> &itemIds) = 0; |
42 | virtual void insertItems(const QByteArray &cacheId, const QList<quint32> &itemIds, |
43 | const QList<QImage> &items) = 0; |
44 | virtual void releaseItems(const QByteArray &cacheId, const QList<quint32> &itemIds) = 0; |
45 | virtual void endRequestBatch() = 0; |
46 | |
47 | virtual bool requestBatchStarted() const = 0; |
48 | |
49 | virtual uint textureIdForBuffer(void *bufferId) = 0; |
50 | virtual void referenceBuffer(void *bufferId) = 0; |
51 | virtual bool dereferenceBuffer(void *bufferId) = 0; |
52 | virtual QSize sizeOfBuffer(void *bufferId) = 0; |
53 | virtual void *eglImageForBuffer(void *bufferId) = 0; |
54 | |
55 | Q_SIGNALS: |
56 | void itemsMissing(const QByteArray &cacheId, const QList<quint32> &itemIds); |
57 | void itemsAvailable(const QByteArray &cacheId, void *bufferId, const QList<quint32> &itemIds, |
58 | const QList<QPoint> &positionsInBuffer); |
59 | void itemsInvalidated(const QByteArray &cacheId, const QList<quint32> &itemIds); |
60 | void itemsUpdated(const QByteArray &cacheId, void *bufferId, const QList<quint32> &itemIds, |
61 | const QList<QPoint> &positionsInBuffer); |
62 | }; |
63 | |
64 | QT_END_NAMESPACE |
65 | |
66 | #endif // QPLATFORMSHAREDGRAPHICSCACHE_H |
67 | |