Cocoa: Make grabWindow work on retina displays.
Not taking the devicePixelRatio into account causes us to either grab a quarter of the screen or do a low-resolution grab. Change-Id: Ie6b681e3a089f17b63554c8158bb471a14963d7a Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>bb10
parent
e37d579183
commit
47e12eafdd
|
|
@ -170,13 +170,13 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
|
|||
windowSize.setHeight(windowRect.height());
|
||||
}
|
||||
|
||||
QPixmap windowPixmap(windowSize);
|
||||
QPixmap windowPixmap(windowSize * devicePixelRatio());
|
||||
windowPixmap.fill(Qt::transparent);
|
||||
|
||||
for (uint i = 0; i < displayCount; ++i) {
|
||||
const CGRect bounds = CGDisplayBounds(displays[i]);
|
||||
int w = (width < 0 ? bounds.size.width : width);
|
||||
int h = (height < 0 ? bounds.size.height : 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);
|
||||
QCFType<CGImageRef> image = CGDisplayCreateImageForRect(displays[i],
|
||||
CGRectMake(displayRect.x(), displayRect.y(), displayRect.width(), displayRect.height()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue