image/qimagepixmapcleanuphooks.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qimagepixmapcleanuphooks_p.h" -
43#include <qpa/qplatformpixmap.h> -
44#include "private/qimage_p.h" -
45 -
46 -
47QT_BEGIN_NAMESPACE -
48 -
49Q_GLOBAL_STATIC(QImagePixmapCleanupHooks, qt_image_and_pixmap_cleanup_hooks)
never executed: delete x;
never executed: return thisGlobalStatic.pointer.load();
never evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
never evaluated: !thisGlobalStatic.pointer.load()
never evaluated: !thisGlobalStatic.destroyed
0
50 -
51QImagePixmapCleanupHooks *QImagePixmapCleanupHooks::instance() -
52{ -
53 return qt_image_and_pixmap_cleanup_hooks();
never executed: return qt_image_and_pixmap_cleanup_hooks();
0
54} -
55 -
56void QImagePixmapCleanupHooks::addPlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd hook) -
57{ -
58 pixmapModificationHooks.append(hook);
never executed (the execution status of this line is deduced): pixmapModificationHooks.append(hook);
-
59}
never executed: }
0
60 -
61void QImagePixmapCleanupHooks::addPlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) -
62{ -
63 pixmapDestructionHooks.append(hook);
never executed (the execution status of this line is deduced): pixmapDestructionHooks.append(hook);
-
64}
never executed: }
0
65 -
66 -
67void QImagePixmapCleanupHooks::addImageHook(_qt_image_cleanup_hook_64 hook) -
68{ -
69 imageHooks.append(hook);
never executed (the execution status of this line is deduced): imageHooks.append(hook);
-
70}
never executed: }
0
71 -
72void QImagePixmapCleanupHooks::removePlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd hook) -
73{ -
74 pixmapModificationHooks.removeAll(hook);
never executed (the execution status of this line is deduced): pixmapModificationHooks.removeAll(hook);
-
75}
never executed: }
0
76 -
77void QImagePixmapCleanupHooks::removePlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) -
78{ -
79 pixmapDestructionHooks.removeAll(hook);
never executed (the execution status of this line is deduced): pixmapDestructionHooks.removeAll(hook);
-
80}
never executed: }
0
81 -
82void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook) -
83{ -
84 imageHooks.removeAll(hook);
never executed (the execution status of this line is deduced): imageHooks.removeAll(hook);
-
85}
never executed: }
0
86 -
87void QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(QPlatformPixmap* pmd) -
88{ -
89 QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
never executed (the execution status of this line is deduced): QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
-
90 // the global destructor for the pixmap and image hooks might have -
91 // been called already if the app is "leaking" global -
92 // pixmaps/images -
93 if (!h)
never evaluated: !h
0
94 return;
never executed: return;
0
95 for (int i = 0; i < h->pixmapModificationHooks.count(); ++i)
never evaluated: i < h->pixmapModificationHooks.count()
0
96 h->pixmapModificationHooks[i](pmd);
never executed: h->pixmapModificationHooks[i](pmd);
0
97}
never executed: }
0
98 -
99void QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(QPlatformPixmap* pmd) -
100{ -
101 QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
never executed (the execution status of this line is deduced): QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
-
102 // the global destructor for the pixmap and image hooks might have -
103 // been called already if the app is "leaking" global -
104 // pixmaps/images -
105 if (!h)
never evaluated: !h
0
106 return;
never executed: return;
0
107 for (int i = 0; i < h->pixmapDestructionHooks.count(); ++i)
never evaluated: i < h->pixmapDestructionHooks.count()
0
108 h->pixmapDestructionHooks[i](pmd);
never executed: h->pixmapDestructionHooks[i](pmd);
0
109}
never executed: }
0
110 -
111void QImagePixmapCleanupHooks::executeImageHooks(qint64 key) -
112{ -
113 QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
never executed (the execution status of this line is deduced): QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
-
114 // the global destructor for the pixmap and image hooks might have -
115 // been called already if the app is "leaking" global -
116 // pixmaps/images -
117 if (!h)
never evaluated: !h
0
118 return;
never executed: return;
0
119 for (int i = 0; i < h->imageHooks.count(); ++i)
never evaluated: i < h->imageHooks.count()
0
120 h->imageHooks[i](key);
never executed: h->imageHooks[i](key);
0
121}
never executed: }
0
122 -
123 -
124void QImagePixmapCleanupHooks::enableCleanupHooks(QPlatformPixmap *handle) -
125{ -
126 handle->is_cached = true;
never executed (the execution status of this line is deduced): handle->is_cached = true;
-
127}
never executed: }
0
128 -
129void QImagePixmapCleanupHooks::enableCleanupHooks(const QPixmap &pixmap) -
130{ -
131 enableCleanupHooks(const_cast<QPixmap &>(pixmap).data_ptr().data());
never executed (the execution status of this line is deduced): enableCleanupHooks(const_cast<QPixmap &>(pixmap).data_ptr().data());
-
132}
never executed: }
0
133 -
134void QImagePixmapCleanupHooks::enableCleanupHooks(const QImage &image) -
135{ -
136 const_cast<QImage &>(image).data_ptr()->is_cached = true;
never executed (the execution status of this line is deduced): const_cast<QImage &>(image).data_ptr()->is_cached = true;
-
137}
never executed: }
0
138 -
139bool QImagePixmapCleanupHooks::isImageCached(const QImage &image) -
140{ -
141 return const_cast<QImage &>(image).data_ptr()->is_cached;
never executed: return const_cast<QImage &>(image).data_ptr()->is_cached;
0
142} -
143 -
144bool QImagePixmapCleanupHooks::isPixmapCached(const QPixmap &pixmap) -
145{ -
146 return const_cast<QPixmap&>(pixmap).data_ptr().data()->is_cached;
never executed: return const_cast<QPixmap&>(pixmap).data_ptr().data()->is_cached;
0
147} -
148 -
149 -
150 -
151QT_END_NAMESPACE -
152 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial