Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qpixmapcache_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QPIXMAPCACHE_P_H
5#define QPIXMAPCACHE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. This header
12// file may change from version to version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <QtGui/private/qtguiglobal_p.h>
18#include "qpixmapcache.h"
19#include "qpaintengine.h"
20#include <private/qimage_p.h>
21#include <private/qpixmap_raster_p.h>
22#include "qcache.h"
23
25
27{
28public:
29 KeyData() : isValid(true), key(0), ref(1) {}
30 KeyData(const KeyData &other)
31 : isValid(other.isValid), key(other.key), ref(1) {}
32 ~KeyData() {}
33
35 bool isValid;
36 int key;
37 int ref;
38};
39
40// XXX: hw: is this a general concept we need to abstract?
42{
43public:
44 QPixmapCacheEntry(const QPixmapCache::Key &key, const QPixmap &pix) : QPixmap(pix), key(key)
45 {
46 QPlatformPixmap *pd = handle();
47 if (pd && pd->classId() == QPlatformPixmap::RasterClass) {
48 QRasterPlatformPixmap *d = static_cast<QRasterPlatformPixmap*>(pd);
49 if (!d->image.isNull() && d->image.d->paintEngine
50 && !d->image.d->paintEngine->isActive())
51 {
52 delete d->image.d->paintEngine;
53 d->image.d->paintEngine = nullptr;
54 }
55 }
56 }
59};
60
61QT_END_NAMESPACE
62
63#endif // QPIXMAPCACHE_P_H
bool remove(const QString &key)
bool insert(const QString &key, const QPixmap &pixmap, int cost)
void releaseKey(const QPixmapCache::Key &key)
static QPixmapCache::KeyData * getKeyData(QPixmapCache::Key *key)
bool flushDetachedPixmaps(bool nt)
QPixmap * object(const QString &key) const
static QPixmapCache::KeyData * get(const QPixmapCache::Key &key)
void resizeKeyArray(int size)
QPixmapCache::Key createKey()
QPixmapCache::Key insert(const QPixmap &pixmap, int cost)
void timerEvent(QTimerEvent *) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
QPixmapCache::Key key
QPixmapCacheEntry(const QPixmapCache::Key &key, const QPixmap &pix)
KeyData(const KeyData &other)
static const int cache_limit_default
static bool qt_pixmapcache_thread_test()
static qsizetype cost(const QPixmap &pixmap)
Q_AUTOTEST_EXPORT int qt_qpixmapcache_qpixmapcache_total_used()
Q_AUTOTEST_EXPORT void qt_qpixmapcache_flush_detached_pixmaps()