| 1 |
/* |
| 2 |
SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <[email protected]> |
| 3 |
|
| 4 |
SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 |
*/ |
| 6 |
|
| 7 |
#ifndef MANAGEDTEXTURENODE_H |
| 8 |
#define MANAGEDTEXTURENODE_H |
| 9 |
|
| 10 |
#include <QSGSimpleTextureNode> |
| 11 |
#include <QSGTexture> |
| 12 |
#include <QSharedPointer> |
| 13 |
|
| 14 |
/** |
| 15 |
* @short Node that contains a reference counted texture |
| 16 |
* |
| 17 |
* Usually when assigning textures within a node, we'll want to delete the |
| 18 |
* texture with the node. This class will take a shared texture and display it |
| 19 |
* within the node. |
| 20 |
* |
| 21 |
* It's especially interesting to use this class together with the ImageTexturesCache |
| 22 |
* that will offer us shareable textures and cache them transparently, when asking |
| 23 |
* it to create the texture. |
| 24 |
* |
| 25 |
* @see ImageTexturesCache |
| 26 |
*/ |
| 27 |
|
| 28 |
class ManagedTextureNode : public QSGSimpleTextureNode |
| 29 |
{ |
| 30 |
Q_DISABLE_COPY(ManagedTextureNode) |
| 31 |
public: |
| 32 |
ManagedTextureNode(); |
| 33 |
|
| 34 |
void setTexture(QSharedPointer<QSGTexture> texture); |
| 35 |
|
| 36 |
private: |
| 37 |
QSharedPointer<QSGTexture> m_texture; |
| 38 |
}; |
| 39 |
|
| 40 |
#endif |