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 | |
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')
-rw-r--r-- | src/corelib/global/qglobal.h | 4 | ||||
-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/kernel/qeventdispatcher_mac.mm | 10 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 18 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_mac_p.h | 105 |
7 files changed, 3 insertions, 231 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7b16dff..461bd36 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -319,10 +319,6 @@ namespace QT_NAMESPACE {} # endif #endif -#ifdef QT_MAC_USE_COCOA -#define QT_MAC_NO_QUICKDRAW 1 -#endif - #ifdef __LSB_VERSION__ # if __LSB_VERSION__ < 40 # error "This version of the Linux Standard Base is unsupported" 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; diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index cde0c47..af36d9f 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -506,16 +506,6 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) wakeUp(); emit awake(); -#ifndef QT_MAC_NO_QUICKDRAW - if(!qt_mac_safe_pdev) { //create an empty widget and this can be used for a port anytime - QWidget *tlw = new QWidget; - tlw->setAttribute(Qt::WA_DeleteOnClose); - tlw->setObjectName(QLatin1String("empty_widget")); - tlw->hide(); - qt_mac_safe_pdev = tlw; - } -#endif - bool retVal = false; forever { if (d->interrupt) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 1717fbd..70eea3a 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -1116,23 +1116,9 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event, //update handles GrafPtr qd = 0; CGContextRef cg = 0; -#ifndef QT_MAC_NO_QUICKDRAW - { - if(GetEventParameter(event, kEventParamGrafPort, typeGrafPtr, 0, sizeof(qd), 0, &qd) != noErr) { - GDHandle dev = 0; - GetGWorld(&qd, &dev); //just use the global port.. - } - } - bool end_cg_context = false; - if(GetEventParameter(event, kEventParamCGContextRef, typeCGContextRef, 0, sizeof(cg), 0, &cg) != noErr && qd) { - end_cg_context = true; - QDBeginCGContext(qd, &cg); - } -#else if(GetEventParameter(event, kEventParamCGContextRef, typeCGContextRef, 0, sizeof(cg), 0, &cg) != noErr) { Q_ASSERT(false); } -#endif widget->d_func()->hd = cg; widget->d_func()->qd_hd = qd; CGContextSaveGState(cg); @@ -1252,10 +1238,6 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event, widget->d_func()->hd = 0; widget->d_func()->qd_hd = 0; CGContextRestoreGState(cg); -#ifndef QT_MAC_NO_QUICKDRAW - if(end_cg_context) - QDEndCGContext(qd, &cg); -#endif } else if(!HIObjectIsOfClass((HIObjectRef)hiview, kObjectQWidget)) { CallNextEventHandler(er, event); } diff --git a/src/gui/painting/qpaintengine_mac_p.h b/src/gui/painting/qpaintengine_mac_p.h index 755b7b1..20a4a08 100644 --- a/src/gui/painting/qpaintengine_mac_p.h +++ b/src/gui/painting/qpaintengine_mac_p.h @@ -58,9 +58,6 @@ #include "private/qpaintengine_p.h" #include "private/qpolygonclipper_p.h" #include "QtCore/qhash.h" -#ifndef QT_MAC_NO_QUICKDRAW -#include <private/qwidget_p.h> -#endif typedef struct CGColorSpace *CGColorSpaceRef; QT_BEGIN_NAMESPACE @@ -69,108 +66,6 @@ extern int qt_defaultDpi(); extern int qt_defaultDpiX(); extern int qt_defaultDpiY(); -#ifndef QT_MAC_NO_QUICKDRAW -class QMacSavedPortInfo -{ - RgnHandle clip; - GWorldPtr world; - GDHandle handle; - PenState pen; //go pennstate - RGBColor back, fore; - bool valid_gworld; - void init(); - -public: - inline QMacSavedPortInfo() { init(); } - inline QMacSavedPortInfo(QPaintDevice *pd) { init(); setPaintDevice(pd); } - inline QMacSavedPortInfo(QPaintDevice *pd, const QRect &r) - { init(); setPaintDevice(pd); setClipRegion(r); } - inline QMacSavedPortInfo(QPaintDevice *pd, const QRegion &r) - { init(); setPaintDevice(pd); setClipRegion(r); } - ~QMacSavedPortInfo(); - static inline bool setClipRegion(const QRect &r); - static inline bool setClipRegion(const QRegion &r); - static inline bool setPaintDevice(QPaintDevice *); -}; - -inline bool -QMacSavedPortInfo::setClipRegion(const QRect &rect) -{ - Rect r; - SetRect(&r, rect.x(), rect.y(), rect.right()+1, rect.bottom()+1); - ClipRect(&r); - return true; -} - -inline bool -QMacSavedPortInfo::setClipRegion(const QRegion &r) -{ - if(r.isEmpty()) - return setClipRegion(QRect()); - QMacSmartQuickDrawRegion rgn(r.toQDRgn()); - SetClip(rgn); - return true; -} - -inline bool -QMacSavedPortInfo::setPaintDevice(QPaintDevice *pd) -{ - if(!pd) - return false; - bool ret = true; - extern GrafPtr qt_mac_qd_context(const QPaintDevice *); // qpaintdevice_mac.cpp - if(pd->devType() == QInternal::Widget) - SetPortWindowPort(qt_mac_window_for(static_cast<QWidget*>(pd))); - else if(pd->devType() == QInternal::Pixmap || pd->devType() == QInternal::Printer) - SetGWorld((GrafPtr)qt_mac_qd_context(pd), 0); //set the gworld - return ret; -} - -inline void -QMacSavedPortInfo::init() -{ - GetBackColor(&back); - GetForeColor(&fore); - GetGWorld(&world, &handle); - valid_gworld = true; - clip = NewRgn(); - GetClip(clip); - GetPenState(&pen); -} - -inline QMacSavedPortInfo::~QMacSavedPortInfo() -{ - bool set_state = false; - if(valid_gworld) { - set_state = IsValidPort(world); - if(set_state) - SetGWorld(world,handle); //always do this one first - } else { - setPaintDevice(qt_mac_safe_pdev); - } - if(set_state) { - SetClip(clip); - SetPenState(&pen); - RGBForeColor(&fore); - RGBBackColor(&back); - } - DisposeRgn(clip); -} -#else -class QMacSavedPortInfo -{ -public: - inline QMacSavedPortInfo() { } - inline QMacSavedPortInfo(QPaintDevice *) { } - inline QMacSavedPortInfo(QPaintDevice *, const QRect &) { } - inline QMacSavedPortInfo(QPaintDevice *, const QRegion &) { } - ~QMacSavedPortInfo() { } - static inline bool setClipRegion(const QRect &) { return false; } - static inline bool setClipRegion(const QRegion &) { return false; } - static inline bool setPaintDevice(QPaintDevice *) { return false; } -}; -#endif - class QCoreGraphicsPaintEnginePrivate; class QCoreGraphicsPaintEngine : public QPaintEngine { |