Coverage Report

Created: 2026-06-14 06:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qtbase/src/gui/image/qpixmapcache_p.h
Line
Count
Source
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
25
QT_BEGIN_NAMESPACE
26
27
class QPixmapCache::KeyData
28
{
29
public:
30
0
    KeyData() : isValid(true), key(0), ref(1) {}
31
    KeyData(const KeyData &other)
32
0
     : isValid(other.isValid), key(other.key), ref(1) {}
33
0
    ~KeyData() {}
34
35
    QString stringKey;
36
    bool isValid;
37
    int key;
38
    int ref;
39
};
40
41
// XXX: hw: is this a general concept we need to abstract?
42
class QPixmapCacheEntry : public QPixmap
43
{
44
public:
45
0
    QPixmapCacheEntry(const QPixmapCache::Key &key, const QPixmap &pix) : QPixmap(pix), key(key)
46
0
    {
47
0
        QPlatformPixmap *pd = handle();
48
0
        if (pd && pd->classId() == QPlatformPixmap::RasterClass) {
49
0
            QRasterPlatformPixmap *d = static_cast<QRasterPlatformPixmap*>(pd);
50
0
            if (!d->image.isNull() && d->image.d->paintEngine
51
0
                && !d->image.d->paintEngine->isActive())
52
0
            {
53
0
                delete d->image.d->paintEngine;
54
0
                d->image.d->paintEngine = nullptr;
55
0
            }
56
0
        }
57
0
    }
58
    ~QPixmapCacheEntry();
59
    QPixmapCache::Key key;
60
};
61
62
QT_END_NAMESPACE
63
64
#endif // QPIXMAPCACHE_P_H