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#include <QSGTexture>
10
11class TextureCache
12{
13public:
14 TextureCache()
15 {
16 }
17
18 /**
19 * @returns the texture for a given @p window and @p image.
20 *
21 * If an @p image id is the same as one already provided before, we won't create
22 * a new texture and return a shared pointer to the existing texture.
23 */
24 static std::shared_ptr<QSGTexture> loadTexture(QQuickWindow *window, const QImage &image, QQuickWindow::CreateTextureOptions options);
25 static std::shared_ptr<QSGTexture> loadTexture(QQuickWindow *window, const QImage &image);
26
27private:
28 inline static QHash<QPair<qint64, QWindow *>, std::weak_ptr<QSGTexture>> s_cache;
29};
30

source code of kirigami/src/primitives/scenegraph/texturecache.h