void QPixmap::setMask( const QBitmap &newmask ) { const QPixmap *tmp = &newmask; // dec cxx bug if ( (data == tmp->data) || ( newmask.handle() && newmask.handle() == handle() ) ) { QPixmap m = tmp->copy( TRUE ); setMask( *((QBitmap*)&m) ); data->selfmask = TRUE; // mask == pixmap return; } if ( newmask.isNull() ) { // reset the mask if (data->mask) { detach(); data->selfmask = FALSE; delete data->mask; data->mask = 0; } return; } detach(); data->selfmask = FALSE; if ( newmask.width() != width() || newmask.height() != height() ) { #if defined(QT_CHECK_RANGE) qWarning( "QPixmap::setMask: The pixmap and the mask must have " "the same size" ); #endif return; } #if defined(Q_WS_MAC) || (defined(Q_WS_X11) && !defined(QT_NO_XFTFREETYPE)) // when setting the mask, we get rid of the alpha channel completely delete data->alphapm; data->alphapm = 0; #endif // Q_WS_X11 && !QT_NO_XFTFREETYPE delete data->mask; QBitmap* newmaskcopy; if ( newmask.mask() ) newmaskcopy = (QBitmap*)new QPixmap( tmp->copy( TRUE ) ); else newmaskcopy = new QBitmap( newmask ); #ifdef Q_WS_X11 newmaskcopy->x11SetScreen( x11Screen() ); #endif data->mask = newmaskcopy; }