diff options
author | Norwegian Rock Cat <qt-info@nokia.com> | 2009-06-11 21:01:35 (GMT) |
---|---|---|
committer | Norwegian Rock Cat <qt-info@nokia.com> | 2009-06-23 14:19:05 (GMT) |
commit | 48fe6dfaf0a52e8a0463fe3fd23015ea63d9d65a (patch) | |
tree | 335822e20cda6614f0cbc5c4fb21c369146a1ad3 /src/gui/painting | |
parent | 9205078f3b2d842735599fd74d6324a4d84bc275 (diff) | |
download | Qt-48fe6dfaf0a52e8a0463fe3fd23015ea63d9d65a.zip Qt-48fe6dfaf0a52e8a0463fe3fd23015ea63d9d65a.tar.gz Qt-48fe6dfaf0a52e8a0463fe3fd23015ea63d9d65a.tar.bz2 |
More culling of Panther Code.
Removed lots of places where we check for Tiger. Now we can assume it.
Reviewed-by: Morten Sørvig
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpaintdevice_mac.cpp | 7 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_mac.cpp | 81 | ||||
-rw-r--r-- | src/gui/painting/qprintengine_mac.mm | 41 | ||||
-rw-r--r-- | src/gui/painting/qprinterinfo_mac.cpp | 10 |
4 files changed, 18 insertions, 121 deletions
diff --git a/src/gui/painting/qpaintdevice_mac.cpp b/src/gui/painting/qpaintdevice_mac.cpp index 92ca52d..7de56ac 100644 --- a/src/gui/painting/qpaintdevice_mac.cpp +++ b/src/gui/painting/qpaintdevice_mac.cpp @@ -142,14 +142,9 @@ Q_GUI_EXPORT CGContextRef qt_mac_cg_context(const QPaintDevice *pdev) if (pdev->devType() == QInternal::Pixmap) { const QPixmap *pm = static_cast<const QPixmap*>(pdev); CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev); -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) uint flags = kCGImageAlphaPremultipliedFirst; #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version - if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) - flags |= kCGBitmapByteOrder32Host; -#endif -#else - CGImageAlphaInfo flags = kCGImageAlphaPremultipliedFirst; + flags |= kCGBitmapByteOrder32Host; #endif CGContextRef ret = 0; diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp index 282cce8..793460f 100644 --- a/src/gui/painting/qpaintengine_mac.cpp +++ b/src/gui/painting/qpaintengine_mac.cpp @@ -102,14 +102,9 @@ QMacCGContext::QMacCGContext(QPainter *p) extern CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice); CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pe->paintDevice()); -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) uint flags = kCGImageAlphaPremultipliedFirst; #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version - if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) - flags |= kCGBitmapByteOrder32Host; -#endif -#else - CGImageAlphaInfo flags = kCGImageAlphaPremultipliedFirst; + flags |= kCGBitmapByteOrder32Host; #endif const QImage *image = (const QImage *) pe->paintDevice(); @@ -528,23 +523,12 @@ static void qt_mac_dispose_pattern(void *info) inline static QPaintEngine::PaintEngineFeatures qt_mac_cg_features() { - QPaintEngine::PaintEngineFeatures ret(QPaintEngine::AllFeatures - & ~QPaintEngine::PaintOutsidePaintEvent - & ~QPaintEngine::PerspectiveTransform - & ~QPaintEngine::ConicalGradientFill - & ~QPaintEngine::LinearGradientFill - & ~QPaintEngine::RadialGradientFill - & ~QPaintEngine::BrushStroke); - -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { - ; - } else -#endif - { - ret &= ~QPaintEngine::BlendModes; - } - return ret; + return QPaintEngine::PaintEngineFeatures(QPaintEngine::AllFeatures & ~QPaintEngine::PaintOutsidePaintEvent + & ~QPaintEngine::PerspectiveTransform + & ~QPaintEngine::ConicalGradientFill + & ~QPaintEngine::LinearGradientFill + & ~QPaintEngine::RadialGradientFill + & ~QPaintEngine::BrushStroke); } QCoreGraphicsPaintEngine::QCoreGraphicsPaintEngine() @@ -994,22 +978,8 @@ void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, co CGContextSetFillColorWithColor(d->hd, cgColorForQColor(col, d->pdev)); image = qt_mac_create_imagemask(pm, sr); } else if (differentSize) { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { - QCFType<CGImageRef> img = pm.toMacCGImageRef(); - image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height()))); - } else -#endif - { - const int sx = qRound(sr.x()), sy = qRound(sr.y()), sw = qRound(sr.width()), sh = qRound(sr.height()); - const QMacPixmapData *pmData = static_cast<const QMacPixmapData*>(pm.data); - quint32 *pantherData = pmData->pixels + sy * (pmData->bytesPerRow / 4) + sx; - QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(0, pantherData, sw*sh*pmData->bytesPerRow, 0); - image = CGImageCreate(sw, sh, 8, 32, pmData->bytesPerRow, - macGenericColorSpace(), - kCGImageAlphaPremultipliedFirst, provider, 0, 0, - kCGRenderingIntentDefault); - } + QCFType<CGImageRef> img = pm.toMacCGImageRef(); + image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height()))); } else { image = (CGImageRef)pm.macCGHandle(); } @@ -1031,11 +1001,7 @@ CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imag else image = new QImage(img); -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) uint cgflags = kCGImageAlphaNone; -#else - CGImageAlphaInfo cgflags = kCGImageAlphaNone; -#endif switch (image->format()) { case QImage::Format_ARGB32_Premultiplied: cgflags = kCGImageAlphaPremultipliedFirst; @@ -1048,9 +1014,8 @@ CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imag default: break; } -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) && defined(kCGBitmapByteOrder32Host) //only needed because CGImage.h added symbols in the minor version - if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) - cgflags |= kCGBitmapByteOrder32Host; +#if defined(kCGBitmapByteOrder32Host) //only needed because CGImage.h added symbols in the minor version + cgflags |= kCGBitmapByteOrder32Host; #endif QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(image, static_cast<const QImage *>(image)->bits(), @@ -1078,27 +1043,9 @@ void QCoreGraphicsPaintEngine::drawImage(const QRectF &r, const QImage &img, con const QImage *image; QCFType<CGImageRef> cgimage = qt_mac_createCGImageFromQImage(img, &image); CGRect rect = CGRectMake(r.x(), r.y(), r.width(), r.height()); - if (QRectF(0, 0, img.width(), img.height()) != sr) { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { - cgimage = CGImageCreateWithImageInRect(cgimage, CGRectMake(sr.x(), sr.y(), - sr.width(), sr.height())); - } else -#endif - { - int sx = qRound(sr.x()); - int sy = qRound(sr.y()); - int sw = qRound(sr.width()); - int sh = qRound(sr.height()); - // Make another CGImage based on the part that we need. - const uchar *pantherData = image->scanLine(sy) + sx * sizeof(uint); - QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(0, pantherData, - sw * sh * image->bytesPerLine(), 0); - cgimage = CGImageCreate(sw, sh, 8, 32, image->bytesPerLine(), - macGenericColorSpace(), - CGImageGetAlphaInfo(cgimage), dataProvider, 0, false, kCGRenderingIntentDefault); - } - } + if (QRectF(0, 0, img.width(), img.height()) != sr) + cgimage = CGImageCreateWithImageInRect(cgimage, CGRectMake(sr.x(), sr.y(), + sr.width(), sr.height())); qt_mac_drawCGImage(d->hd, &rect, cgimage); } diff --git a/src/gui/painting/qprintengine_mac.mm b/src/gui/painting/qprintengine_mac.mm index 255a0a1..1c4505f 100644 --- a/src/gui/painting/qprintengine_mac.mm +++ b/src/gui/painting/qprintengine_mac.mm @@ -92,16 +92,8 @@ bool QMacPrintEngine::begin(QPaintDevice *dev) } OSStatus status = noErr; #ifndef QT_MAC_USE_COCOA -# if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { - status = d->shouldSuppressStatus() ? PMSessionBeginCGDocumentNoDialog(d->session, d->settings, d->format) - : PMSessionBeginCGDocument(d->session, d->settings, d->format); - } else -# endif - { - status = d->shouldSuppressStatus() ? PMSessionBeginDocumentNoDialog(d->session, d->settings, d->format) - : PMSessionBeginDocument(d->session, d->settings, d->format); - } + status = d->shouldSuppressStatus() ? PMSessionBeginCGDocumentNoDialog(d->session, d->settings, d->format) + : PMSessionBeginCGDocument(d->session, d->settings, d->format); #else status = PMSessionBeginCGDocumentNoDialog(d->session, d->settings, d->format); #endif @@ -468,23 +460,6 @@ void QMacPrintEnginePrivate::initialize() #endif #ifndef QT_MAC_USE_COCOA -# if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_4) -# endif - { - if(paintEngine->type() == QPaintEngine::CoreGraphics) { - CFStringRef strings[1] = { kPMGraphicsContextCoreGraphics }; - QCFType<CFArrayRef> contextArray = CFArrayCreate(kCFAllocatorDefault, - reinterpret_cast<const void **>(strings), - 1, &kCFTypeArrayCallBacks); - OSStatus err = PMSessionSetDocumentFormatGeneration(session, kPMDocumentFormatPDF, - contextArray, 0); - if(err != noErr) { - qWarning("QMacPrintEngine::initialize: Cannot set format generation to PDF: %ld", err); - state = QPrinter::Error; - } - } - } if (!settingsOK || !formatOK) { qWarning("QMacPrintEngine::initialize: Unable to initialize QPainter"); state = QPrinter::Error; @@ -551,19 +526,7 @@ bool QMacPrintEnginePrivate::newPage_helper() CGContextRef cgContext; OSStatus err = noErr; -#ifndef QT_MAC_USE_COCOA -# if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { - err = PMSessionGetCGGraphicsContext(session, &cgContext); - } else -# endif - { - err = PMSessionGetGraphicsContext(session, kPMGraphicsContextCoreGraphics, - reinterpret_cast<void **>(&cgContext)); - } -#else err = PMSessionGetCGGraphicsContext(session, &cgContext); -#endif if(err != noErr) { qWarning("QMacPrintEngine::newPage: Cannot retrieve CoreGraphics context: %ld", long(err)); state = QPrinter::Error; diff --git a/src/gui/painting/qprinterinfo_mac.cpp b/src/gui/painting/qprinterinfo_mac.cpp index 9cf94b2..c84271c 100644 --- a/src/gui/painting/qprinterinfo_mac.cpp +++ b/src/gui/painting/qprinterinfo_mac.cpp @@ -172,16 +172,9 @@ bool QPrinterInfo::isDefault() const QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const { -#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4) - return QList<QPrinter::PaperSize>(); -#else - if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4) - return QList<QPrinter::PaperSize>(); - const Q_D(QPrinterInfo); - PMPrinter cfPrn = PMPrinterCreateFromPrinterID( - QCFString::toCFStringRef(d->m_name)); + PMPrinter cfPrn = PMPrinterCreateFromPrinterID(QCFString::toCFStringRef(d->m_name)); if (!cfPrn) return QList<QPrinter::PaperSize>(); @@ -211,7 +204,6 @@ QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const PMRelease(cfPrn); return paperList; -#endif // MAC_OS_X_VERSION_MAX_ALLOWED } ///////////////////////////////////////////////////////////////////////////// |