diff options
author | Norwegian Rock Cat <qt-info@nokia.com> | 2009-07-24 11:28:12 (GMT) |
---|---|---|
committer | Norwegian Rock Cat <qt-info@nokia.com> | 2009-07-24 11:28:12 (GMT) |
commit | ed2a03b3bc85be056eca87928d18a746faa07bca (patch) | |
tree | dbfd8d2874c12f3229537dac08ed454587cfa306 /src/gui/image | |
parent | 5e157ed2fc5a3780959da0246ceb2b20fabbbeb5 (diff) | |
download | Qt-ed2a03b3bc85be056eca87928d18a746faa07bca.zip Qt-ed2a03b3bc85be056eca87928d18a746faa07bca.tar.gz Qt-ed2a03b3bc85be056eca87928d18a746faa07bca.tar.bz2 |
Remove all the last vestiges of QuickDraw in Qt/Mac.
Panther was the last reason for having this around. We don't touch this
code anywhere else in Qt. As a result it's orphaned and can be safely
removed. It truly is the end of an era, but it's definitely worth
celebrating. Quartz4Life!
Diffstat (limited to 'src/gui/image')
-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 |
3 files changed, 3 insertions, 94 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 3e5c9b7..18829f4 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -671,12 +671,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, @@ -1945,11 +1940,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..c14c059 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 \em{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 \em{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; |