qimagepixmapcleanuphooks.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/image/qimagepixmapcleanuphooks.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5namespace { namespace Q_QGS_qt_image_and_pixmap_cleanup_hooks { typedef QImagePixmapCleanupHooks Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QImagePixmapCleanupHooks, Q_QGS_qt_image_and_pixmap_cleanup_hooks::innerFunction, Q_QGS_qt_image_and_pixmap_cleanup_hooks::guard> qt_image_and_pixmap_cleanup_hooks;-
6-
7QImagePixmapCleanupHooks *QImagePixmapCleanupHooks::instance()-
8{-
9 return qt_image_and_pixmap_cleanup_hooks();-
10}-
11-
12void QImagePixmapCleanupHooks::addPlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd hook)-
13{-
14 pixmapModificationHooks.append(hook);-
15}-
16-
17void QImagePixmapCleanupHooks::addPlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd hook)-
18{-
19 pixmapDestructionHooks.append(hook);-
20}-
21-
22-
23void QImagePixmapCleanupHooks::addImageHook(_qt_image_cleanup_hook_64 hook)-
24{-
25 imageHooks.append(hook);-
26}-
27-
28void QImagePixmapCleanupHooks::removePlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd hook)-
29{-
30 pixmapModificationHooks.removeAll(hook);-
31}-
32-
33void QImagePixmapCleanupHooks::removePlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd hook)-
34{-
35 pixmapDestructionHooks.removeAll(hook);-
36}-
37-
38void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook)-
39{-
40 imageHooks.removeAll(hook);-
41}-
42-
43void QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(QPlatformPixmap* pmd)-
44{-
45 const QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();-
46-
47-
48-
49 if (!h
!hDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
50 return;
never executed: return;
0
51 for (int i = 0; i <auto hook : h->pixmapModificationHooks.count(); ++i)-
52 h->pixmapModificationHooks[i](hook(
never executed: hook(pmd);
pmd);
never executed: hook(pmd);
0
53}
never executed: end of block
0
54-
55void QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(QPlatformPixmap* pmd)-
56{-
57 const QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();-
58-
59-
60-
61 if (!h
!hDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
62 return;
never executed: return;
0
63 for (int i = 0; i <auto hook : h->pixmapDestructionHooks.count(); ++i)-
64 h->pixmapDestructionHooks[i](hook(
never executed: hook(pmd);
pmd);
never executed: hook(pmd);
0
65}
never executed: end of block
0
66-
67void QImagePixmapCleanupHooks::executeImageHooks(qint64 key)-
68{-
69 const QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();-
70-
71-
72-
73 if (!h
!hDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
74 return;
never executed: return;
0
75 for (int i = 0; i <auto hook : h->imageHooks.count(); ++i)-
76 h->imageHooks[i](hook(
never executed: hook(key);
key);
never executed: hook(key);
0
77}
never executed: end of block
0
78-
79-
80void QImagePixmapCleanupHooks::enableCleanupHooks(QPlatformPixmap *handle)-
81{-
82 handle->is_cached = true;-
83}-
84-
85void QImagePixmapCleanupHooks::enableCleanupHooks(const QPixmap &pixmap)-
86{-
87 enableCleanupHooks(const_cast<QPixmap &>(pixmap).data_ptr().data());-
88}-
89-
90void QImagePixmapCleanupHooks::enableCleanupHooks(const QImage &image)-
91{-
92 const_cast<QImage &>(image).data_ptr()->is_cached = true;-
93}-
94-
95bool QImagePixmapCleanupHooks::isImageCached(const QImage &image)-
96{-
97 return const_cast<QImage &>(image).data_ptr()->is_cached;-
98}-
99-
100bool QImagePixmapCleanupHooks::isPixmapCached(const QPixmap &pixmap)-
101{-
102 return const_cast<QPixmap&>(pixmap).data_ptr().data()->is_cached;-
103}-
104-
105-
106-
107-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9