Warning, file /frameworks/kdeclarative/src/quickaddons/imagetexturescache.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef IMAGETEXTURESCACHE_H 0008 #define IMAGETEXTURESCACHE_H 0009 0010 #include <QQuickWindow> 0011 #include <QSharedPointer> 0012 0013 #include "quickaddons_export.h" 0014 0015 class QImage; 0016 class QSGTexture; 0017 class ImageTexturesCachePrivate; 0018 0019 /** 0020 * @class ImageTexturesCache imagetexturescache.h KQuickAddons/ImageTexturesCache 0021 * 0022 * @short Helps to manage textures by creating images and reference counts them. 0023 * 0024 * Use this class as a factory for textures, when creating them from a QImage 0025 * instance. 0026 * Keeps track of all the created textures in a map between the QImage::cacheKey() and 0027 * the cached texture until it gets de-referenced. 0028 * 0029 * @see ManagedTextureNode 0030 */ 0031 class QUICKADDONS_EXPORT ImageTexturesCache 0032 { 0033 public: 0034 ImageTexturesCache(); 0035 ~ImageTexturesCache(); 0036 0037 /** 0038 * @returns the texture for a given @p window and @p image. 0039 * 0040 * If an @p image id is the same as one already provided before, we won't create 0041 * a new texture and return a shared pointer to the existing texture. 0042 */ 0043 QSharedPointer<QSGTexture> loadTexture(QQuickWindow *window, const QImage &image, QQuickWindow::CreateTextureOptions options); 0044 0045 QSharedPointer<QSGTexture> loadTexture(QQuickWindow *window, const QImage &image); 0046 0047 private: 0048 QScopedPointer<ImageTexturesCachePrivate> d; 0049 }; 0050 0051 #endif // IMAGETEXTURESCACHE_H