src/gui/image/qpixmapdata.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
child 33 3e2da88830cd
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
    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;