summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h26
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm199
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm13
-rw-r--r--src/plugins/platforms/cocoa/qmacmime.mm2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm17
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac.mm6
11 files changed, 98 insertions, 175 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 30c15d823a..3ca611b537 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -122,7 +122,7 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy)
CGImageRef QCocoaBackingStore::getBackingStoreCGImage()
{
if (!m_cgImage)
- m_cgImage = qt_mac_toCGImage(m_qImage, false, 0);
+ m_cgImage = qt_mac_toCGImage(m_qImage);
// Warning: do not retain/release/cache the returned image from
// outside the backingstore since it shares data with a QImage and
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index f401459cc3..8728ab8764 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -318,7 +318,7 @@ static QString strippedText(QString s)
}
}
- QString qtFileName = QCFString::toQString(filename);
+ QString qtFileName = QFileInfo(QCFString::toQString(filename)).fileName();
// No filter means accept everything
bool nameMatches = mSelectedNameFilter->isEmpty();
// Check if the current file name filter accepts the file:
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 6f76892d93..9b4d8fd96f 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -162,6 +162,9 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo
QCocoaGLContext::~QCocoaGLContext()
{
+ if (m_currentWindow && m_currentWindow.data()->handle())
+ static_cast<QCocoaWindow *>(m_currentWindow.data()->handle())->setCurrentContext(0);
+
[m_context release];
}
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index 419bf631aa..3b72184d83 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -68,10 +68,12 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list);
inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist)
{ return reinterpret_cast<NSMutableArray *>(qt_mac_QStringListToNSMutableArrayVoid(qstrlist)); }
-CGImageRef qt_mac_image_to_cgimage(const QImage &image);
NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge);
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
NSImage *qt_mac_create_nsimage(const QIcon &icon);
+CGImageRef qt_mac_toCGImage(const QImage &qImage);
+CGImageRef qt_mac_toCGImageMask(const QImage &qImage);
+QImage qt_mac_toQImage(CGImageRef image);
NSSize qt_mac_toNSSize(const QSize &qtSize);
NSRect qt_mac_toNSRect(const QRect &rect);
@@ -101,23 +103,13 @@ CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget);
CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
QString qt_mac_applicationName();
-inline int qt_mac_flipYCoordinate(int y)
-{ return QGuiApplication::primaryScreen()->geometry().height() - y; }
-
-inline qreal qt_mac_flipYCoordinate(qreal y)
-{ return QGuiApplication::primaryScreen()->geometry().height() - y; }
-
-inline QPointF qt_mac_flipPoint(const NSPoint &p)
-{ return QPointF(p.x, qt_mac_flipYCoordinate(p.y)); }
-
-inline NSPoint qt_mac_flipPoint(const QPoint &p)
-{ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y())); }
-
-inline NSPoint qt_mac_flipPoint(const QPointF &p)
-{ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y())); }
+int qt_mac_flipYCoordinate(int y);
+qreal qt_mac_flipYCoordinate(qreal y);
+QPointF qt_mac_flipPoint(const NSPoint &p);
+NSPoint qt_mac_flipPoint(const QPoint &p);
+NSPoint qt_mac_flipPoint(const QPointF &p);
NSRect qt_mac_flipRect(const QRect &rect);
-NSRect qt_mac_flipRect(const QRect &rect, QWindow *window);
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum);
@@ -159,8 +151,6 @@ public:
};
CGContextRef qt_mac_cg_context(QPaintDevice *pdev);
-CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy);
-QImage qt_mac_toQImage(CGImageRef image);
template<typename T>
T qt_mac_resolveOption(const T &fallback, const QByteArray &environment)
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index d27c134fa3..8975605e5c 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -79,24 +79,28 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list)
return result;
}
-static void drawImageReleaseData (void *info, const void *, size_t)
+static void qt_mac_deleteImage(void *image, const void *, size_t)
{
- delete static_cast<QImage *>(info);
+ delete static_cast<QImage *>(image);
}
-CGImageRef qt_mac_image_to_cgimage(const QImage &img)
+// Creates a CGDataProvider with the data from the given image.
+// The data provider retains a copy of the image.
+CGDataProviderRef qt_mac_CGDataProvider(const QImage &image)
{
- if (img.isNull())
+ return CGDataProviderCreateWithData(new QImage(image), image.bits(),
+ image.byteCount(), qt_mac_deleteImage);
+}
+
+CGImageRef qt_mac_toCGImage(const QImage &inImage)
+{
+ if (inImage.isNull())
return 0;
- QImage *image;
- if (img.depth() != 32)
- image = new QImage(img.convertToFormat(QImage::Format_ARGB32_Premultiplied));
- else
- image = new QImage(img);
+ QImage image = (inImage.depth() == 32) ? inImage : inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
uint cgflags = kCGImageAlphaNone;
- switch (image->format()) {
+ switch (image.format()) {
case QImage::Format_ARGB32_Premultiplied:
cgflags = kCGImageAlphaPremultipliedFirst;
break;
@@ -105,20 +109,26 @@ CGImageRef qt_mac_image_to_cgimage(const QImage &img)
break;
case QImage::Format_RGB32:
cgflags = kCGImageAlphaNoneSkipFirst;
+ break;
+ case QImage::Format_RGB888:
+ cgflags |= kCGImageAlphaNone;
+ break;
default:
break;
}
cgflags |= kCGBitmapByteOrder32Host;
- QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(image,
- static_cast<const QImage *>(image)->bits(),
- image->byteCount(),
- drawImageReleaseData);
-
- return CGImageCreate(image->width(), image->height(), 8, 32,
- image->bytesPerLine(),
- qt_mac_genericColorSpace(),
- cgflags, dataProvider, 0, false, kCGRenderingIntentDefault);
+ QCFType<CGDataProviderRef> dataProvider = qt_mac_CGDataProvider(image);
+ return CGImageCreate(image.width(), image.height(), 8, 32,
+ image.bytesPerLine(),
+ qt_mac_genericColorSpace(),
+ cgflags, dataProvider, 0, false, kCGRenderingIntentDefault);
+}
+CGImageRef qt_mac_toCGImageMask(const QImage &image)
+{
+ QCFType<CGDataProviderRef> dataProvider = qt_mac_CGDataProvider(image);
+ return CGImageMaskCreate(image.width(), image.height(), 8, image.depth(),
+ image.bytesPerLine(), dataProvider, NULL, false);
}
NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
@@ -132,7 +142,7 @@ NSImage *qt_mac_create_nsimage(const QPixmap &pm)
if (pm.isNull())
return 0;
QImage image = pm.toImage();
- CGImageRef cgImage = qt_mac_image_to_cgimage(image);
+ CGImageRef cgImage = qt_mac_toCGImage(image);
NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
CGImageRelease(cgImage);
return nsImage;
@@ -147,7 +157,7 @@ NSImage *qt_mac_create_nsimage(const QIcon &icon)
foreach (QSize size, icon.availableSizes()) {
QPixmap pm = icon.pixmap(size);
QImage image = pm.toImage();
- CGImageRef cgImage = qt_mac_image_to_cgimage(image);
+ CGImageRef cgImage = qt_mac_toCGImage(image);
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
[nsImage addRepresentation:imageRep];
[imageRep release];
@@ -585,44 +595,42 @@ QString qt_mac_applicationName()
return appName;
}
-NSRect qt_mac_flipRect(const QRect &rect)
+int qt_mac_mainScreenHeight()
{
- int flippedY = qt_mac_flipYCoordinate(rect.y() + rect.height());
- return NSMakeRect(rect.x(), flippedY, rect.width(), rect.height());
+ // The first screen in the screens array is documented
+ // to have the (0,0) origin.
+ NSRect screenFrame = [[[NSScreen screens] firstObject] frame];
+ return screenFrame.size.height;
}
-/*
- Mac window coordinates are in the first quadrant: 0, 0 is at the lower-left
- corner of the primary screen. This function converts the given rect to an
- NSRect for the window geometry, flipping from 4th quadrant to 1st quadrant
- and simultaneously ensuring that as much of the window as possible will be
- onscreen. If the rect is too tall for the screen, the OS will reduce the
- window's height anyway; but by moving the window upwards we can have more
- of it onscreen. But the application can still control the y coordinate
- in case it really wants the window to be positioned partially offscreen.
-*/
-NSRect qt_mac_flipRect(const QRect &rect, QWindow *window)
-{
- QPlatformScreen *onScreen = QPlatformScreen::platformScreenForWindow(window);
- int flippedY = onScreen->geometry().height() - (rect.y() + rect.height());
- QList<QScreen *> screens = QGuiApplication::screens();
- if (screens.size() > 1) {
- int height = 0;
- foreach (QScreen *scr, screens)
- height = qMax(height, scr->size().height());
- int difference = height - onScreen->geometry().height();
- if (difference > 0)
- flippedY += difference;
- else
- flippedY -= difference;
- }
- // In case of automatic positioning, try to put as much of the window onscreen as possible.
- if (window->isTopLevel() && qt_window_private(const_cast<QWindow*>(window))->positionAutomatic && flippedY < 0)
- flippedY = onScreen->geometry().height() - onScreen->availableGeometry().height() - onScreen->availableGeometry().y();
-#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
- qDebug() << Q_FUNC_INFO << rect << "flippedY" << flippedY <<
- "screen" << onScreen->geometry() << "available" << onScreen->availableGeometry();
-#endif
+int qt_mac_flipYCoordinate(int y)
+{
+ return qt_mac_mainScreenHeight() - y;
+}
+
+qreal qt_mac_flipYCoordinate(qreal y)
+{
+ return qt_mac_mainScreenHeight() - y;
+}
+
+QPointF qt_mac_flipPoint(const NSPoint &p)
+{
+ return QPointF(p.x, qt_mac_flipYCoordinate(p.y));
+}
+
+NSPoint qt_mac_flipPoint(const QPoint &p)
+{
+ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y()));
+}
+
+NSPoint qt_mac_flipPoint(const QPointF &p)
+{
+ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y()));
+}
+
+NSRect qt_mac_flipRect(const QRect &rect)
+{
+ int flippedY = qt_mac_flipYCoordinate(rect.y() + rect.height());
return NSMakeRect(rect.x(), flippedY, rect.width(), rect.height());
}
@@ -780,85 +788,6 @@ CGContextRef qt_mac_cg_context(QPaintDevice *pdev)
return ret;
}
-// qpaintengine_mac.mm
-extern void qt_mac_cgimage_data_free(void *, const void *memoryToFree, size_t);
-
-CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy)
-{
- int width = qImage.width();
- int height = qImage.height();
-
- if (width <= 0 || height <= 0) {
- qWarning() << Q_FUNC_INFO <<
- "setting invalid size" << width << "x" << height << "for qnsview image";
- return 0;
- }
-
- const uchar *imageData = qImage.bits();
- if (dataCopy) {
- *dataCopy = static_cast<uchar *>(malloc(qImage.byteCount()));
- memcpy(*dataCopy, imageData, qImage.byteCount());
- }
- int bitDepth = qImage.depth();
- int colorBufferSize = 8;
- int bytesPrLine = qImage.bytesPerLine();
-
- CGDataProviderRef cgDataProviderRef = CGDataProviderCreateWithData(
- NULL,
- dataCopy ? *dataCopy : imageData,
- qImage.byteCount(),
- dataCopy ? qt_mac_cgimage_data_free : NULL);
-
- CGImageRef cgImage = 0;
- if (isMask) {
- cgImage = CGImageMaskCreate(width,
- height,
- colorBufferSize,
- bitDepth,
- bytesPrLine,
- cgDataProviderRef,
- NULL,
- false);
- } else {
- CGColorSpaceRef cgColourSpaceRef = qt_mac_displayColorSpace(0);
-
- // Create a CGBitmapInfo contiaining the image format.
- // Support the 8-bit per component (A)RGB formats.
- CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little;
- switch (qImage.format()) {
- case QImage::Format_ARGB32_Premultiplied :
- bitmapInfo |= kCGImageAlphaPremultipliedFirst;
- break;
- case QImage::Format_ARGB32 :
- bitmapInfo |= kCGImageAlphaFirst;
- break;
- case QImage::Format_RGB32 :
- bitmapInfo |= kCGImageAlphaNoneSkipFirst;
- break;
- case QImage::Format_RGB888 :
- bitmapInfo |= kCGImageAlphaNone;
- break;
- default:
- qWarning() << "qt_mac_toCGImage: Unsupported image format" << qImage.format();
- break;
- }
-
- cgImage = CGImageCreate(width,
- height,
- colorBufferSize,
- bitDepth,
- bytesPrLine,
- cgColourSpaceRef,
- bitmapInfo,
- cgDataProviderRef,
- NULL,
- false,
- kCGRenderingIntentDefault);
- }
- CGDataProviderRelease(cgDataProviderRef);
- return cgImage;
-}
-
QImage qt_mac_toQImage(CGImageRef image)
{
const size_t w = CGImageGetWidth(image),
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 0c1ddf9ad8..dff7c9bd50 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -487,6 +487,7 @@ void QCocoaIntegration::clearToolbars()
QHash<QWindow *, NSToolbar *>::const_iterator it = mToolbars.constBegin();
while (it != mToolbars.constEnd()) {
[it.value() release];
+ ++it;
}
mToolbars.clear();
}
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index 85ce96a8b6..f4776342de 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -248,7 +248,7 @@ void *QCocoaNativeInterface::qMenuBarToNSMenu(QPlatformMenuBar *platformMenuBar)
CGImageRef QCocoaNativeInterface::qImageToCGImage(const QImage &image)
{
- return qt_mac_toCGImage(image, false, 0);
+ return qt_mac_toCGImage(image);
}
QImage QCocoaNativeInterface::cgImageToQImage(CGImageRef image)
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index d972782f31..bf41270d12 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -392,12 +392,15 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
QWindowSystemInterface::handleGeometryChange(window(), rect);
QWindowSystemInterface::handleExposeEvent(window(), rect);
} else if (m_nsWindow) {
- NSRect bounds = qt_mac_flipRect(rect, window());
+ NSRect bounds = qt_mac_flipRect(rect);
[m_nsWindow setFrame:[m_nsWindow frameRectForContentRect:bounds] display:YES animate:NO];
} else {
[m_contentView setFrame : NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
}
+ if (!m_qtView)
+ QPlatformWindow::setGeometry(rect);
+
// will call QPlatformWindow::setGeometry(rect) during resize confirmation (see qnsview.mm)
}
@@ -415,7 +418,7 @@ void QCocoaWindow::clipWindow(const NSRect &clipRect)
NSRect clippedWindowRect = NSZeroRect;
if (!NSIsEmptyRect(clipRect)) {
- NSRect windowFrame = qt_mac_flipRect(QRect(window()->mapToGlobal(QPoint(0, 0)), geometry().size()), window());
+ NSRect windowFrame = qt_mac_flipRect(QRect(window()->mapToGlobal(QPoint(0, 0)), geometry().size()));
clippedWindowRect = NSIntersectionRect(windowFrame, clipRect);
// Clipping top/left offsets the content. Move it back.
NSPoint contentViewOffset = NSMakePoint(qMax(CGFloat(0), NSMinX(clippedWindowRect) - NSMinX(windowFrame)),
@@ -1153,6 +1156,10 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
// Child windows have no NSWindow, link the NSViews instead.
[m_parentCocoaWindow->m_contentView addSubview : m_contentView];
QRect rect = window()->geometry();
+ // Prevent setting a (0,0) window size; causes opengl context
+ // "Invalid Drawable" warnings.
+ if (rect.isNull())
+ rect.setSize(QSize(1, 1));
NSRect frame = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height());
[m_contentView setFrame:frame];
[m_contentView setHidden: YES];
@@ -1201,7 +1208,7 @@ NSWindow * QCocoaWindow::createNSWindow()
QCocoaAutoReleasePool pool;
QRect rect = initialGeometry(window(), window()->geometry(), defaultWindowWidth, defaultWindowHeight);
- NSRect frame = qt_mac_flipRect(rect, window());
+ NSRect frame = qt_mac_flipRect(rect);
Qt::WindowType type = window()->type();
Qt::WindowFlags flags = window()->flags();
diff --git a/src/plugins/platforms/cocoa/qmacmime.mm b/src/plugins/platforms/cocoa/qmacmime.mm
index 89d1b5f681..4274e178f7 100644
--- a/src/plugins/platforms/cocoa/qmacmime.mm
+++ b/src/plugins/platforms/cocoa/qmacmime.mm
@@ -565,7 +565,7 @@ QList<QByteArray> QMacPasteboardMimeTiff::convertFromMime(const QString &mime, Q
return ret;
QImage img = qvariant_cast<QImage>(variant);
- QCFType<CGImageRef> cgimage = qt_mac_image_to_cgimage(img);
+ QCFType<CGImageRef> cgimage = qt_mac_toCGImage(img);
QCFType<CFMutableDataRef> data = CFDataCreateMutable(0, 0);
QCFType<CGImageDestinationRef> imageDestination = CGImageDestinationCreateWithData(data, kUTTypeTIFF, 1, 0);
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 58c732de98..fcca96a8a8 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -80,7 +80,6 @@ static QTouchDevice *touchDevice = 0;
if (self) {
m_backingStore = 0;
m_maskImage = 0;
- m_maskData = 0;
m_shouldInvalidateWindowShadow = false;
m_window = 0;
m_buttons = Qt::NoButton;
@@ -106,7 +105,6 @@ static QTouchDevice *touchDevice = 0;
{
CGImageRelease(m_maskImage);
m_maskImage = 0;
- m_maskData = 0;
m_window = 0;
m_subscribesForGlobalFrameNotifications = false;
[m_inputSource release];
@@ -372,7 +370,7 @@ static QTouchDevice *touchDevice = 0;
- (BOOL) hasMask
{
- return m_maskData != 0;
+ return m_maskImage != 0;
}
- (BOOL) isOpaque
@@ -405,7 +403,7 @@ static QTouchDevice *touchDevice = 0;
dst[x] = src[x] & 0xff;
}
}
- m_maskImage = qt_mac_toCGImage(maskImage, true, &m_maskData);
+ m_maskImage = qt_mac_toCGImageMask(maskImage);
}
- (void)invalidateWindowShadowIfNeeded
@@ -861,14 +859,9 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
uint deviceId = [theEvent deviceID];
if (!tabletDeviceDataHash->contains(deviceId)) {
- // 10.6 sends tablet events for trackpad interaction, but
- // not proximity events. Silence the warning to prevent
- // flooding the console.
- if (QSysInfo::QSysInfo::MacintoshVersion == QSysInfo::MV_10_6)
- return;
-
- qWarning("QNSView handleTabletEvent: This tablet device is unknown"
- " (received no proximity event for it). Discarding event.");
+ // Error: Unknown tablet device. Qt also gets into this state
+ // when running on a VM. This appears to be harmless; don't
+ // print a warning.
return;
}
const QCocoaTabletDeviceData &deviceData = tabletDeviceDataHash->value(deviceId);
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
index 40d60a6a0a..61fbe3a61f 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
@@ -488,7 +488,7 @@ static void qt_mac_draw_pattern(void *info, CGContextRef c)
if (isBitmap)
pat->image = qt_mac_create_imagemask(pat->data.pixmap, pat->data.pixmap.rect());
else
- pat->image = qt_mac_image_to_cgimage(pat->data.pixmap.toImage());
+ pat->image = qt_mac_toCGImage(pat->data.pixmap.toImage());
}
} else {
w = CGImageGetWidth(pat->image);
@@ -963,11 +963,11 @@ 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) {
- QCFType<CGImageRef> img = qt_mac_image_to_cgimage(pm.toImage());
+ QCFType<CGImageRef> img = qt_mac_toCGImage(pm.toImage());
if (img)
image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height())));
} else {
- image = qt_mac_image_to_cgimage(pm.toImage());
+ image = qt_mac_toCGImage(pm.toImage());
}
qt_mac_drawCGImage(d->hd, &rect, image);
if (doRestore)