Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickpixmapcache.cpp File Reference
#include <QtQuick/private/qquickpixmapcache_p.h>
#include <QtQuick/private/qquickimageprovider_p.h>
#include <QtQuick/private/qquickprofiler_p.h>
#include <QtQuick/private/qsgcontext_p.h>
#include <QtQuick/private/qsgrenderer_p.h>
#include <QtQuick/private/qsgtexturereader_p.h>
#include <QtQuick/qquickwindow.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qimage_p.h>
#include <QtGui/qpa/qplatformintegration.h>
#include <QtGui/qimagereader.h>
#include <QtGui/qpixmapcache.h>
#include <QtQml/private/qqmlglobal_p.h>
#include <QtQml/private/qqmlengine_p.h>
#include <QtQml/qqmlfile.h>
#include <QtCore/private/qobject_p.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qhash.h>
#include <QtCore/qfile.h>
#include <QtCore/qthread.h>
#include <QtCore/qmutex.h>
#include <QtCore/qbuffer.h>
#include <QtCore/qdebug.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qscopeguard.h>
#include <qquickpixmapcache.moc>
#include "moc_qquickpixmapcache_p.cpp"
+ Include dependency graph for qquickpixmapcache.cpp:

Go to the source code of this file.

Classes

class  QQuickPixmapReply
 
class  QQuickPixmapReply::Event
 
class  ReaderThreadExecutionEnforcer
 
class  QQuickPixmapReader
 
class  QQuickPixmapData
 
class  BackendSupport
 
class  QQuickPixmapKey
 
class  QQuickPixmapStore
 
struct  QQuickPixmapNull
 

Macros

#define IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT   8
 
#define CACHE_EXPIRE_TIME   30
 
#define CACHE_REMOVAL_FRACTION   4
 
#define PIXMAP_PROFILE(Code)   Q_QUICK_PROFILE(QQuickProfiler::ProfilePixmapCache, Code)
 
#define USE_THREADED_DOWNLOAD   0
 
#define Q_THREAD_AFFINITY_MARKER(x)
 
#define Q_ASSERT_CALLED_ON_VALID_THREAD(x)
 
#define Q_DETACH_THREAD_AFFINITY_MARKER(x)
 
#define PIXMAP_READER_LOCK()
 

Functions

static QString imageProviderId (const QUrl &url)
 
static QString imageId (const QUrl &url)
 
static void maybeRemoveAlpha (QImage *image)
 
static bool readImage (const QUrl &url, QIODevice *dev, QImage *image, QString *errorString, QSize *impsize, int *frameCount, const QRect &requestRegion, const QSize &requestSize, const QQuickImageProviderOptions &providerOptions, QQuickImageProviderOptions::AutoTransform *appliedTransform=nullptr, int frame=0, qreal devicePixelRatio=1.0)
 
static QStringList fromLatin1List (const QList< QByteArray > &list)
 
 Q_GLOBAL_STATIC (BackendSupport, backendSupport)
 
static QString existingImageFileForPath (const QString &localFile)
 
bool operator== (const QQuickPixmapKey &lhs, const QQuickPixmapKey &rhs)
 
size_t qHash (const QQuickPixmapKey &key, size_t seed) noexcept
 
 Q_GLOBAL_STATIC (QQuickPixmapStore, pixmapStore)
 
static QQuickPixmapDatacreatePixmapDataSync (QQuickPixmap *declarativePixmap, QQmlEngine *engine, const QUrl &url, const QRect &requestRegion, const QSize &requestSize, const QQuickImageProviderOptions &providerOptions, int frame, bool *ok, qreal devicePixelRatio)
 
 Q_GLOBAL_STATIC (QQuickPixmapNull, nullPixmap)
 

Variables

static int cache_limit = 2048 * 1024
 

Macro Definition Documentation

◆ CACHE_EXPIRE_TIME

#define CACHE_EXPIRE_TIME   30

Definition at line 40 of file qquickpixmapcache.cpp.

◆ CACHE_REMOVAL_FRACTION

#define CACHE_REMOVAL_FRACTION   4

Definition at line 41 of file qquickpixmapcache.cpp.

◆ IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT

#define IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT   8

Definition at line 39 of file qquickpixmapcache.cpp.

◆ PIXMAP_PROFILE

#define PIXMAP_PROFILE (   Code)    Q_QUICK_PROFILE(QQuickProfiler::ProfilePixmapCache, Code)

Definition at line 43 of file qquickpixmapcache.cpp.

◆ PIXMAP_READER_LOCK

#define PIXMAP_READER_LOCK ( )

Definition at line 278 of file qquickpixmapcache.cpp.

◆ Q_ASSERT_CALLED_ON_VALID_THREAD

#define Q_ASSERT_CALLED_ON_VALID_THREAD (   x)

Definition at line 85 of file qquickpixmapcache.cpp.

◆ Q_DETACH_THREAD_AFFINITY_MARKER

#define Q_DETACH_THREAD_AFFINITY_MARKER (   x)

Definition at line 86 of file qquickpixmapcache.cpp.

◆ Q_THREAD_AFFINITY_MARKER

#define Q_THREAD_AFFINITY_MARKER (   x)

Definition at line 84 of file qquickpixmapcache.cpp.

◆ USE_THREADED_DOWNLOAD

#define USE_THREADED_DOWNLOAD   0

Definition at line 48 of file qquickpixmapcache.cpp.

Function Documentation

◆ createPixmapDataSync()

static QQuickPixmapData * createPixmapDataSync ( QQuickPixmap declarativePixmap,
QQmlEngine engine,
const QUrl url,
const QRect requestRegion,
const QSize requestSize,
const QQuickImageProviderOptions providerOptions,
int  frame,
bool *  ok,
qreal  devicePixelRatio 
)
static

◆ existingImageFileForPath()

static QString existingImageFileForPath ( const QString localFile)
static

Definition at line 540 of file qquickpixmapcache.cpp.

References QFileInfo::exists(), fi, QString::isEmpty(), QStringLiteral, QString::replace(), QString::size(), and QFileInfo::suffix().

Referenced by createPixmapDataSync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromLatin1List()

static QStringList fromLatin1List ( const QList< QByteArray > &  list)
static

Definition at line 513 of file qquickpixmapcache.cpp.

References QString::fromLatin1(), item, list, and QList< T >::size().

Referenced by BackendSupport::BackendSupport().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ imageId()

static QString imageId ( const QUrl url)
inlinestatic

Definition at line 101 of file qquickpixmapcache.cpp.

References QString::mid(), QUrl::RemoveAuthority, QUrl::RemoveScheme, QUrl::toString(), and url.

Referenced by createPixmapDataSync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ imageProviderId()

static QString imageProviderId ( const QUrl url)
inlinestatic

Definition at line 96 of file qquickpixmapcache.cpp.

References QUrl::host(), and url.

Referenced by createPixmapDataSync(), and QQuickPixmap::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maybeRemoveAlpha()

static void maybeRemoveAlpha ( QImage image)
static

Definition at line 430 of file qquickpixmapcache.cpp.

References Qt::AutoColor, QImage::Format_A2BGR30_Premultiplied, QImage::Format_A2RGB30_Premultiplied, QImage::Format_BGR30, QImage::Format_RGB30, QImage::Format_RGB32, QImage::Format_RGBA8888, QImage::Format_RGBA8888_Premultiplied, and QImage::Format_RGBX8888.

Referenced by readImage().

+ Here is the caller graph for this function:

◆ operator==()

bool operator== ( const QQuickPixmapKey lhs,
const QQuickPixmapKey rhs 
)
inline

◆ Q_GLOBAL_STATIC() [1/3]

Q_GLOBAL_STATIC ( BackendSupport  ,
backendSupport   
)

◆ Q_GLOBAL_STATIC() [2/3]

Q_GLOBAL_STATIC ( QQuickPixmapNull  ,
nullPixmap   
)

◆ Q_GLOBAL_STATIC() [3/3]

Q_GLOBAL_STATIC ( QQuickPixmapStore  ,
pixmapStore   
)

◆ qHash()

size_t qHash ( const QQuickPixmapKey key,
size_t  seed 
)
inlinenoexcept

Definition at line 1167 of file qquickpixmapcache.cpp.

References qHashMulti(), and seed.

+ Here is the call graph for this function:

◆ readImage()

static bool readImage ( const QUrl url,
QIODevice dev,
QImage image,
QString errorString,
QSize impsize,
int *  frameCount,
const QRect requestRegion,
const QSize requestSize,
const QQuickImageProviderOptions providerOptions,
QQuickImageProviderOptions::AutoTransform appliedTransform = nullptr,
int  frame = 0,
qreal  devicePixelRatio = 1.0 
)
static

Variable Documentation

◆ cache_limit

int cache_limit = 2048 * 1024
static

Definition at line 94 of file qquickpixmapcache.cpp.