summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2012-07-12 08:54:05 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-07-13 11:08:18 (GMT)
commitbaeb42184402454da3e337bbfa2f4d5c7346435f (patch)
treea385b3f3af4c1cf75de8357b54a312853100aae4 /src
parentf3aafa06e95f38dfee38b84f09990b050303bb7d (diff)
downloadQt-baeb42184402454da3e337bbfa2f4d5c7346435f.zip
Qt-baeb42184402454da3e337bbfa2f4d5c7346435f.tar.gz
Qt-baeb42184402454da3e337bbfa2f4d5c7346435f.tar.bz2
Support high resolution screens in QUIKit plugin
We need to duplicate the scale factor of the screen for the UIView to avoid the final blit to scale the framebuffer, and we need to report scaled metrics to Qt. Change-Id: I79f9a06708436e70e8e7f632f2248b70813214f9 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/uikit/quikitscreen.mm6
-rw-r--r--src/plugins/platforms/uikit/quikitwindow.mm9
2 files changed, 13 insertions, 2 deletions
diff --git a/src/plugins/platforms/uikit/quikitscreen.mm b/src/plugins/platforms/uikit/quikitscreen.mm
index 42a0cd6..b7e2324 100644
--- a/src/plugins/platforms/uikit/quikitscreen.mm
+++ b/src/plugins/platforms/uikit/quikitscreen.mm
@@ -54,7 +54,11 @@ QUIKitScreen::QUIKitScreen(int screenIndex)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CGRect bounds = [uiScreen() bounds];
- m_geometry = QRect(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height);
+ CGFloat scale = [uiScreen() scale];
+ m_geometry = QRect(bounds.origin.x * scale,
+ bounds.origin.y * scale,
+ bounds.size.width * scale,
+ bounds.size.height * scale);
m_format = QImage::Format_ARGB32_Premultiplied;
diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm
index 288944c..99ba149 100644
--- a/src/plugins/platforms/uikit/quikitwindow.mm
+++ b/src/plugins/platforms/uikit/quikitwindow.mm
@@ -262,7 +262,8 @@ private:
{
UITouch *touch = [touches anyObject];
CGPoint locationInView = [touch locationInView:self];
- QPoint p(locationInView.x, locationInView.y);
+ CGFloat scaleFactor = [self contentScaleFactor];
+ QPoint p(locationInView.x * scaleFactor, locationInView.y * scaleFactor);
// TODO handle global touch point? for status bar?
QWindowSystemInterface::handleMouseEvent(mWindow->widget(), (ulong)(event.timestamp*1000),
p, p, buttons);
@@ -370,6 +371,7 @@ UIWindow *QUIKitWindow::ensureNativeWindow()
// view
[mView deleteFramebuffer];
mView.frame = CGRectMake(0, 0, mWindow.bounds.size.width, mWindow.bounds.size.height); // fill
+ [mView setContentScaleFactor:[mWindow.screen scale]];
[mView setMultipleTouchEnabled:YES];
[mView setWindow:this];
[mWindow addSubview:mView];
@@ -413,6 +415,11 @@ void QUIKitWindow::updateGeometryAndOrientation()
angle = +M_PI/2.;
break;
}
+
+ CGFloat scale = [mScreen->uiScreen() scale];
+ geom = QRect(geom.x() * scale, geom.y() * scale,
+ geom.width() * scale, geom.height() * scale);
+
if (angle != 0) {
[mView layer].transform = CATransform3DMakeRotation(angle, 0, 0, 1.);
} else {