Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qimagepixmapcleanuphooks.cpp
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
5#include <qpa/qplatformpixmap.h>
6#include "private/qimage_p.h"
7
8
10
11Q_GLOBAL_STATIC(QImagePixmapCleanupHooks, qt_image_and_pixmap_cleanup_hooks)
12
14{
15 return qt_image_and_pixmap_cleanup_hooks();
16}
17
22
27
28
33
38
43
48
50{
51 const QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
52 // the global destructor for the pixmap and image hooks might have
53 // been called already if the app is "leaking" global
54 // pixmaps/images
55 if (!h)
56 return;
57 for (auto hook : h->pixmapModificationHooks)
58 hook(pmd);
59}
60
62{
63 const QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
64 // the global destructor for the pixmap and image hooks might have
65 // been called already if the app is "leaking" global
66 // pixmaps/images
67 if (!h)
68 return;
69 for (auto hook : h->pixmapDestructionHooks)
70 hook(pmd);
71}
72
74{
75 const QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
76 // the global destructor for the pixmap and image hooks might have
77 // been called already if the app is "leaking" global
78 // pixmaps/images
79 if (!h)
80 return;
81 for (auto hook : h->imageHooks)
82 hook(key);
83}
84
85
90
95
97{
98 const_cast<QImage &>(image).data_ptr()->is_cached = true;
99}
100
102{
103 return const_cast<QImage &>(image).data_ptr()->is_cached;
104}
105
107{
108 return const_cast<QPixmap&>(pixmap).data_ptr().data()->is_cached;
109}
110
111
112
void addPlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd)
static bool isPixmapCached(const QPixmap &pixmap)
void removeImageHook(_qt_image_cleanup_hook_64)
static void executeImageHooks(qint64 key)
void removePlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd)
static void executePlatformPixmapDestructionHooks(QPlatformPixmap *)
static void executePlatformPixmapModificationHooks(QPlatformPixmap *)
void addPlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd)
void addImageHook(_qt_image_cleanup_hook_64)
void removePlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd)
static void enableCleanupHooks(const QImage &image)
static bool isImageCached(const QImage &image)
\inmodule QtGui
Definition qimage.h:37
qsizetype removeAll(const AT &t)
Definition qlist.h:592
void append(parameter_type t)
Definition qlist.h:458
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
The QPlatformPixmap class provides an abstraction for native pixmaps.
Combined button and popup list for selecting options.
Definition image.cpp:4
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
void(* _qt_pixmap_cleanup_hook_pmd)(QPlatformPixmap *)
QT_BEGIN_NAMESPACE typedef void(* _qt_image_cleanup_hook_64)(qint64)
GLuint64 GLenum void * handle
GLuint64 key
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat GLfloat GLfloat h
const void * data_ptr(const QTransform &t)
Definition qpainter_p.h:48
long long qint64
Definition qtypes.h:60
widget render & pixmap