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/image | |
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/image')
-rw-r--r-- | src/gui/image/qicon.cpp | 6 | ||||
-rw-r--r-- | src/gui/image/qnativeimage.cpp | 3 | ||||
-rw-r--r-- | src/gui/image/qpixmap_mac.cpp | 79 |
3 files changed, 14 insertions, 74 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index edae29a..fa407c7 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -54,7 +54,7 @@ #ifdef Q_WS_MAC #include <private/qt_mac_p.h> -#include <Carbon/Carbon.h> +#include <private/qt_cocoa_helpers_mac_p.h> #endif QT_BEGIN_NAMESPACE @@ -178,8 +178,8 @@ QPixmapIconEngine::~QPixmapIconEngine() void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) { QSize pixmapSize = rect.size(); -#if defined(Q_WS_MAC) && !defined(Q_WS_MAC64) - pixmapSize *= (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) ? HIGetScaleFactor() : 1; +#if defined(Q_WS_MAC) + pixmapSize *= qt_mac_get_scalefactor(); #endif painter->drawPixmap(rect, pixmap(pixmapSize, mode, state)); } diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index bfe5dfe..e3fb27a 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -236,8 +236,7 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* uint cgflags = kCGImageAlphaNoneSkipFirst; #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version - if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) - cgflags |= kCGBitmapByteOrder32Host; + cgflags |= kCGBitmapByteOrder32Host; #endif cg = CGBitmapContextCreate(image.bits(), width, height, 8, image.bytesPerLine(), cgColorSpace, cgflags); diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index b40694a..c281fe9 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -119,14 +119,9 @@ CGImageRef qt_mac_image_to_cgimage(const QImage &image) CGDataProviderCreateWithData(0, image.bits(), image.bytesPerLine() * image.height(), 0); -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) uint cgflags = kCGImageAlphaPremultipliedFirst; #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version - if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) - cgflags |= kCGBitmapByteOrder32Host; -#endif -#else - CGImageAlphaInfo cgflags = kCGImageAlphaPremultipliedFirst; + cgflags |= kCGBitmapByteOrder32Host; #endif CGImageRef cgImage = CGImageCreate(image.width(), image.height(), bitsPerColor, bitsPerPixel, @@ -645,14 +640,9 @@ void QMacPixmapData::macCreateCGImageRef() pixels, bytesPerRow * h, qt_mac_cgimage_data_free); validDataPointers.insert(this); -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) uint cgflags = kCGImageAlphaPremultipliedFirst; #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version - if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) - cgflags |= kCGBitmapByteOrder32Host; -#endif -#else - CGImageAlphaInfo cgflags = kCGImageAlphaPremultipliedFirst; + cgflags |= kCGBitmapByteOrder32Host; #endif cg_data = CGImageCreate(w, h, 8, 32, bytesPerRow, colorspace, cgflags, provider, 0, 0, kCGRenderingIntentDefault); @@ -893,38 +883,6 @@ static void qt_mac_grabDisplayRect(CGDirectDisplayID display, const QRect &displ ptrCGLDestroyContext(glContextObj); // and destroy the context } -static CGImageRef qt_mac_createImageFromBitmapContext(CGContextRef c) -{ - void *rasterData = CGBitmapContextGetData(c); - const int width = CGBitmapContextGetBytesPerRow(c), - height = CGBitmapContextGetHeight(c); - size_t imageDataSize = width*height; - - if(!rasterData) - return 0; - - // Create the data provider from the image data, using - // the image releaser function releaseBitmapContextImageData. - CGDataProviderRef dataProvider = CGDataProviderCreateWithData(0, rasterData, - imageDataSize, - qt_mac_cgimage_data_free); - - if(!dataProvider) - return 0; - - uint bitmapInfo = 0; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - if(CGBitmapContextGetBitmapInfo) - bitmapInfo = CGBitmapContextGetBitmapInfo(c); - else -#endif - bitmapInfo = CGBitmapContextGetAlphaInfo(c); - return CGImageCreate(width, height, CGBitmapContextGetBitsPerComponent(c), - CGBitmapContextGetBitsPerPixel(c), CGBitmapContextGetBytesPerRow(c), - CGBitmapContextGetColorSpace(c), bitmapInfo, dataProvider, - 0, true, kCGRenderingIntentDefault); -} - // Returns a pixmap containing the screen contents at rect. static QPixmap qt_mac_grabScreenRect(const QRect &rect) { @@ -958,19 +916,8 @@ static QPixmap qt_mac_grabScreenRect(const QRect &rect) rect.height(), 8, bytewidth, QCoreGraphicsPaintEngine::macGenericColorSpace(), kCGImageAlphaNoneSkipFirst); - -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { - QCFType<CGImageRef> image = CGBitmapContextCreateImage(bitmap); - return QPixmap::fromMacCGImageRef(image); - } else -#endif - { - QCFType<CGImageRef> image = qt_mac_createImageFromBitmapContext(bitmap); - if (!image) - return QPixmap(); - return QPixmap::fromMacCGImageRef(image); - } + QCFType<CGImageRef> image = CGBitmapContextCreateImage(bitmap); + return QPixmap::fromMacCGImageRef(image); } #ifndef QT_MAC_USE_COCOA // no QuickDraw in 64-bit mode @@ -1043,18 +990,12 @@ Qt::HANDLE QPixmap::macQDHandle() const SetRect(&rect, 0, 0, d->w, d->h); unsigned long qdformat = k32ARGBPixelFormat; GWorldFlags qdflags = 0; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { - //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 0 - qdflags |= kNativeEndianPixMap; -#endif - } -#endif + //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); |