diff options
author | Andy Shaw <andy.shaw@digia.com> | 2013-10-07 10:40:35 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-07 13:57:46 +0200 |
commit | 2cfca47d568502a5d10c07caf60b38cc505d3f5e (patch) | |
tree | e4baebc5ed67f7b385ce35599b11418760940728 /src | |
parent | ae4c7be67d6a840a8d724bb1f986314cbbe47eb3 (diff) |
Fix QScreen::grabWindow for multiple screens on Mac
QScreen::grabWindow() would only with the primary screen on Mac, if you
tried to grab a secondary one then it would end up with a blank pixmap.
Change-Id: I24f604051835db96286c693f5ed60a2633b6528e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.mm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 8ce72e08b5..2e42b9acda 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -199,6 +199,7 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height int w = (width < 0 ? bounds.size.width : width) * devicePixelRatio(); int h = (height < 0 ? bounds.size.height : height) * devicePixelRatio(); QRect displayRect = QRect(x, y, w, h); + displayRect = displayRect.translated(qRound(-bounds.origin.x), qRound(-bounds.origin.y)); QCFType<CGImageRef> image = CGDisplayCreateImageForRect(displays[i], CGRectMake(displayRect.x(), displayRect.y(), displayRect.width(), displayRect.height())); QPixmap pix(w, h); @@ -209,7 +210,7 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height CGContextRelease(ctx); QPainter painter(&windowPixmap); - painter.drawPixmap(bounds.origin.x, bounds.origin.y, pix); + painter.drawPixmap(0, 0, pix); } return windowPixmap; } |