Line | Source Code | Coverage |
---|
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 | | - |
47 | QT_BEGIN_NAMESPACE | - |
48 | | - |
49 | Q_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 | | - |
51 | QImagePixmapCleanupHooks *QImagePixmapCleanupHooks::instance() | - |
52 | { | - |
53 | return qt_image_and_pixmap_cleanup_hooks(); never executed: return qt_image_and_pixmap_cleanup_hooks(); | 0 |
54 | } | - |
55 | | - |
56 | void 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 | } | 0 |
60 | | - |
61 | void 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 | } | 0 |
65 | | - |
66 | | - |
67 | void 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 | } | 0 |
71 | | - |
72 | void 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 | } | 0 |
76 | | - |
77 | void 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 | } | 0 |
81 | | - |
82 | void 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 | } | 0 |
86 | | - |
87 | void 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) | 0 |
94 | 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 | } | 0 |
98 | | - |
99 | void 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) | 0 |
106 | 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 | } | 0 |
110 | | - |
111 | void 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) | 0 |
118 | 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 | } | 0 |
122 | | - |
123 | | - |
124 | void 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 | } | 0 |
128 | | - |
129 | void 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 | } | 0 |
133 | | - |
134 | void 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 | } | 0 |
138 | | - |
139 | bool 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 | | - |
144 | bool 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 | | - |
151 | QT_END_NAMESPACE | - |
152 | | - |
| | |