Kirigami2

managedtexturenode.h
1/*
2 * SPDX-FileCopyrightText: 2011 Marco Martin <mart@kde.org>
3 * SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
4 * SPDX-FileCopyrightText: 2020 Carson Black <uhhadd@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8
9#pragma once
10#include <QImage>
11#include <QQuickWindow>
12#include <QSGSimpleTextureNode>
13#include <QSGTexture>
14#include <memory>
15
16class ManagedTextureNode : public QSGSimpleTextureNode
17{
18 Q_DISABLE_COPY(ManagedTextureNode)
19public:
20 ManagedTextureNode();
21
22 void setTexture(std::shared_ptr<QSGTexture> texture);
23
24private:
25 std::shared_ptr<QSGTexture> m_texture;
26};
27
29
30struct ImageTexturesCachePrivate {
31 TexturesCache cache;
32};
33
35{
36public:
39
40 /**
41 * @returns the texture for a given @p window and @p image.
42 *
43 * If an @p image id is the same as one already provided before, we won't create
44 * a new texture and return a shared pointer to the existing texture.
45 */
46 std::shared_ptr<QSGTexture> loadTexture(QQuickWindow *window, const QImage &image, QQuickWindow::CreateTextureOptions options);
47
48 std::shared_ptr<QSGTexture> loadTexture(QQuickWindow *window, const QImage &image);
49
50private:
51 std::unique_ptr<ImageTexturesCachePrivate> d;
52};
QSharedPointer< QSGTexture > loadTexture(QQuickWindow *window, const QImage &image, QQuickWindow::CreateTextureOptions options)
typedef CreateTextureOptions
QSGTexture * texture() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:46 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.