diff options
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qimage.cpp | 5 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 12 | ||||
-rw-r--r-- | src/gui/image/qpixmap_mac.cpp | 80 | ||||
-rw-r--r-- | src/gui/image/qpixmap_mac_p.h | 5 | ||||
-rw-r--r-- | src/gui/image/qpixmapcache.h | 2 |
5 files changed, 6 insertions, 98 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index d3a4855..d71aef3 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -596,9 +596,8 @@ bool QImageData::checkForAlphaPixels() const The mirrored() function returns a mirror of the image in the desired direction, the scaled() returns a copy of the image scaled - to a rectangle of the desired measures, the rgbSwapped() function - constructs a BGR image from a RGB image, and the alphaChannel() - function constructs an image from this image's alpha channel. + to a rectangle of the desired measures, and the rgbSwapped() function + constructs a BGR image from a RGB image. The scaledToWidth() and scaledToHeight() functions return scaled copies of the image. diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 12287d3..b7d5efd 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -675,12 +675,7 @@ void QPixmap::resize_helper(const QSize &s) p.drawPixmap(0, 0, *this, 0, 0, qMin(width(), w), qMin(height(), h)); } -#if defined(Q_WS_MAC) -#ifndef QT_MAC_NO_QUICKDRAW - if(macData && macData->qd_alpha) - macData->macQDUpdateAlpha(); -#endif -#elif defined(Q_WS_X11) +#if defined(Q_WS_X11) if (x11Data && x11Data->x11_mask) { QX11PixmapData *pmData = static_cast<QX11PixmapData*>(pm.data); pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display, @@ -1952,11 +1947,6 @@ void QPixmap::detach() if (data->ref != 1) { *this = copy(); -#if defined(Q_WS_MAC) && !defined(QT_MAC_NO_QUICKDRAW) - if (id == QPixmapData::MacClass) { - macData->qd_alpha = 0; - } -#endif } ++data->detach_no; diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index 25ef8ba..45392f1 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -166,9 +166,6 @@ QMacPixmapData::QMacPixmapData(PixelType type) : QPixmapData(type, MacClass), has_alpha(0), has_mask(0), uninit(true), pixels(0), pixelsToFree(0), bytesPerRow(0), cg_data(0), cg_dataBeingReleased(0), cg_mask(0), -#ifndef QT_MAC_NO_QUICKDRAW - qd_data(0), qd_alpha(0), -#endif pengine(0) { } @@ -494,13 +491,6 @@ int QMacPixmapData::metric(QPaintDevice::PaintDeviceMetric theMetric) const QMacPixmapData::~QMacPixmapData() { validDataPointers.remove(this); -#ifndef QT_MAC_NO_QUICKDRAW - macQDDisposeAlpha(); - if (qd_data) { - DisposeGWorld(qd_data); - qd_data = 0; - } -#endif if (cg_mask) { CGImageRelease(cg_mask); cg_mask = 0; @@ -589,48 +579,9 @@ void QMacPixmapData::macGetAlphaChannel(QMacPixmapData *pix, bool asMask) const void QMacPixmapData::macSetHasAlpha(bool b) { has_alpha = b; -#ifndef QT_MAC_NO_QUICKDRAW - macQDDisposeAlpha(); //let it get created lazily -#endif macReleaseCGImageRef(); } -#ifndef QT_MAC_NO_QUICKDRAW -void QMacPixmapData::macQDDisposeAlpha() -{ - if (qd_alpha) { - DisposeGWorld(qd_alpha); - qd_alpha = 0; - } -} - -void QMacPixmapData::macQDUpdateAlpha() -{ - macQDDisposeAlpha(); // get rid of alpha pixmap - if (!has_alpha && !has_mask) - return; - - //setup - Rect rect; - SetRect(&rect, 0, 0, w, h); - const int params = alignPix | stretchPix | newDepth; - NewGWorld(&qd_alpha, 32, &rect, 0, 0, params); - int *dptr = (int *)GetPixBaseAddr(GetGWorldPixMap(qd_alpha)), *drow; - unsigned short dbpr = GetPixRowBytes(GetGWorldPixMap(qd_alpha)); - const int *sptr = (int*)pixels, *srow; - const uint sbpr = bytesPerRow; - uchar clr; - for (int y = 0; y < h; ++y) { - drow = (int*)((char *)dptr + (y * dbpr)); - srow = (int*)((char *)sptr + (y * sbpr)); - for (int x=0; x < w; x++) { - clr = qAlpha(*(srow + x)); - *(drow + x) = qRgba(~clr, ~clr, ~clr, 0); - } - } -} -#endif - void QMacPixmapData::macCreateCGImageRef() { Q_ASSERT(cg_data == 0); @@ -979,31 +930,12 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) relocated. \warning This function is only available on Mac OS X. + \warning As of Qt 4.6, this function \e{always} returns zero. */ Qt::HANDLE QPixmap::macQDHandle() const { -#ifndef QT_MAC_NO_QUICKDRAW - QMacPixmapData *d = static_cast<QMacPixmapData*>(data); - if (!d->qd_data) { //create the qd data - Rect rect; - SetRect(&rect, 0, 0, d->w, d->h); - unsigned long qdformat = k32ARGBPixelFormat; - GWorldFlags qdflags = 0; - //we play such games so we can use the same buffer in CG as QD this - //makes our merge much simpler, at some point the hacks will go away - //because QD will be removed, but until that day this keeps them coexisting - if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) - qdformat = k32BGRAPixelFormat; - - if(NewGWorldFromPtr(&d->qd_data, qdformat, &rect, 0, 0, qdflags, - (char*)d->pixels, d->bytesPerRow) != noErr) - qWarning("Qt: internal: QPixmap::init error (%d %d %d %d)", rect.left, rect.top, rect.right, rect.bottom); - } - return d->qd_data; -#else return 0; -#endif } /*! \internal @@ -1013,18 +945,11 @@ Qt::HANDLE QPixmap::macQDHandle() const long as it can be relocated. \warning This function is only available on Mac OS X. + \warning As of Qt 4.6, this function \e{always} returns zero. */ Qt::HANDLE QPixmap::macQDAlphaHandle() const { -#ifndef QT_MAC_NO_QUICKDRAW - QMacPixmapData *d = static_cast<QMacPixmapData*>(data); - if (d->has_alpha || d->has_mask) { - if (!d->qd_alpha) //lazily created - d->macQDUpdateAlpha(); - return d->qd_alpha; - } -#endif return 0; } @@ -1094,7 +1019,6 @@ IconRef qt_mac_create_iconref(const QPixmap &px) if (px.isNull()) return 0; - QMacSavedPortInfo pi; //save the current state //create icon IconFamilyHandle iconFamily = reinterpret_cast<IconFamilyHandle>(NewHandle(0)); //create data diff --git a/src/gui/image/qpixmap_mac_p.h b/src/gui/image/qpixmap_mac_p.h index a3ff0d3..ea6fe60 100644 --- a/src/gui/image/qpixmap_mac_p.h +++ b/src/gui/image/qpixmap_mac_p.h @@ -109,11 +109,6 @@ private: uint bytesPerRow; QRectF cg_mask_rect; CGImageRef cg_data, cg_dataBeingReleased, cg_mask; -#ifndef QT_MAC_NO_QUICKDRAW - GWorldPtr qd_data, qd_alpha; - void macQDDisposeAlpha(); - void macQDUpdateAlpha(); -#endif static QSet<QMacPixmapData*> validDataPointers; QPaintEngine *pengine; diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h index c86f3fa..de589fc 100644 --- a/src/gui/image/qpixmapcache.h +++ b/src/gui/image/qpixmapcache.h @@ -54,7 +54,7 @@ class Q_GUI_EXPORT QPixmapCache { public: class KeyData; - class Key + class Q_GUI_EXPORT Key { public: Key(); |