diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-03-04 21:56:22 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-26 21:44:15 +0100 |
commit | 491dcbfac8da80bc573ba90959a3d610a55db4d0 (patch) | |
tree | 7d68c63feda25c05a777392b46dc6cfb81f0b1c2 /src/widgets | |
parent | 87b3aa9f4fc5c96cee9e2b4c4fd03114af6fcc56 (diff) |
Cocoa: Make retina desktop components work.
Scale non-widget paint devices as well.
Change-Id: Ic68fb166058e9b162f8baeab81196ee254f30b2e
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 4adda2f151..18f5881401 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -6532,15 +6532,12 @@ QMacCGContext::QMacCGContext(QPainter *p) context = CGBitmapContextCreate((void *) image->bits(), image->width(), image->height(), 8, image->bytesPerLine(), colorspace, flags); - CGContextTranslateCTM(context, 0, image->height()); - CGContextScaleCTM(context, 1, -1); + const qreal devicePixelRatio = image->devicePixelRatio(); if (devType == QInternal::Widget) { // Set the clip rect which is an intersection of the system clip // and the painter clip. To make matters more interesting these // are in device pixels and device-independent pixels, respectively. - const qreal devicePixelRatio = image->devicePixelRatio(); - QRegion clip = p->paintEngine()->systemClip(); // get system clip in device pixels QTransform native = p->deviceTransform(); // get device transform. dx/dy is in device pixels @@ -6558,6 +6555,13 @@ QMacCGContext::QMacCGContext(QPainter *p) // Scale the context so that painting happens in device-independet pixels. CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio); CGContextTranslateCTM(context, native.dx() / devicePixelRatio, native.dy() / devicePixelRatio); + } else { + // Invert y axis. + CGContextTranslateCTM(context, 0, image->height()); + CGContextScaleCTM(context, 1, -1); + + // Scale to paint in device-independent pixels. + CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio); } } else { qDebug() << "QMacCGContext:: Unsupported painter devtype type" << devType; |