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// Qt-Security score:significant reason:default
4
5#ifndef QPIXMAPCACHE_P_H
6#define QPIXMAPCACHE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. This header
13// file may change from version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include "qpixmapcache.h"
20#include "qpaintengine.h"
21#include <private/qimage_p.h>
22#include <private/qpixmap_raster_p.h>
23#include "qcache.h"
24
26
28{
29public:
30 KeyData() : isValid(true), key(0), ref(1) {}
31 KeyData(const KeyData &other)
32 : isValid(other.isValid), key(other.key), ref(1) {}
33 ~KeyData() {}
34
36 bool isValid;
37 int key;
38 int ref;
39};
40
41// XXX: hw: is this a general concept we need to abstract?
43{
44public:
45 QPixmapCacheEntry(const QPixmapCache::Key &key, const QPixmap &pix) : QPixmap(pix), key(key)
46 {
47 QPlatformPixmap *pd = handle();
48 if (pd && pd->classId() == QPlatformPixmap::RasterClass) {
49 QRasterPlatformPixmap *d = static_cast<QRasterPlatformPixmap*>(pd);
50 if (!d->image.isNull() && d->image.d->paintEngine
51 && !d->image.d->paintEngine->isActive())
52 {
53 delete d->image.d->paintEngine;
54 d->image.d->paintEngine = nullptr;
55 }
56 }
57 }
60};
61
62QT_END_NAMESPACE
63
64#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)
Combined button and popup list for selecting options.
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()