src/gui/image/qpixmapdata.cpp
branchRCL_3
changeset 8 3f74d0d4af4c
parent 4 3b1da2848fc7
equal deleted inserted replaced
6:dee5afe5301f 8:3f74d0d4af4c
    43 #include <QtCore/qbuffer.h>
    43 #include <QtCore/qbuffer.h>
    44 #include <QtGui/qbitmap.h>
    44 #include <QtGui/qbitmap.h>
    45 #include <QtGui/qimagereader.h>
    45 #include <QtGui/qimagereader.h>
    46 #include <private/qgraphicssystem_p.h>
    46 #include <private/qgraphicssystem_p.h>
    47 #include <private/qapplication_p.h>
    47 #include <private/qapplication_p.h>
       
    48 #include <private/qimagepixmapcleanuphooks_p.h>
    48 
    49 
    49 QT_BEGIN_NAMESPACE
    50 QT_BEGIN_NAMESPACE
    50 
    51 
    51 const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
    52 const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
    52                                      0x10, 0x20, 0x40, 0x80 };
    53                                      0x10, 0x20, 0x40, 0x80 };
    78 {
    79 {
    79 }
    80 }
    80 
    81 
    81 QPixmapData::~QPixmapData()
    82 QPixmapData::~QPixmapData()
    82 {
    83 {
       
    84     // Sometimes the pixmap cleanup hooks will be called from derrived classes, which will
       
    85     // then set is_cached to false. For example, on X11 QtOpenGL needs to delete the GLXPixmap
       
    86     // or EGL Pixmap Surface for a given pixmap _before_ the native X11 pixmap is deleted,
       
    87     // otherwise some drivers will leak the GL surface. In this case, QX11PixmapData will
       
    88     // call the cleanup hooks itself before deleting the native pixmap and set is_cached to
       
    89     // false.
       
    90     if (is_cached) {
       
    91         QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(this);
       
    92         is_cached = false;
       
    93     }
    83 }
    94 }
    84 
    95 
    85 QPixmapData *QPixmapData::createCompatiblePixmapData() const
    96 QPixmapData *QPixmapData::createCompatiblePixmapData() const
    86 {
    97 {
    87     QPixmapData *d;
    98     QPixmapData *d;