aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorVincent Bénony2015-12-08 12:17:46 +0100
committerVincent Bénony2016-01-06 16:17:36 +0100
commit14a0a3d032059ab489a9f5f535972449ba036010 (patch)
tree54f39861671f6533a656a615f548387081fe92d1 /backends/platform
parent481884e778071c1e071c68c4bc03752bed04bccd (diff)
downloadscummvm-rg350-14a0a3d032059ab489a9f5f535972449ba036010.tar.gz
scummvm-rg350-14a0a3d032059ab489a9f5f535972449ba036010.tar.bz2
scummvm-rg350-14a0a3d032059ab489a9f5f535972449ba036010.zip
IOS: Better resolution handling
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/ios7/ios7_common.h2
-rw-r--r--backends/platform/ios7/ios7_osys_main.cpp2
-rw-r--r--backends/platform/ios7/ios7_osys_video.mm2
-rw-r--r--backends/platform/ios7/ios7_video.mm62
4 files changed, 23 insertions, 45 deletions
diff --git a/backends/platform/ios7/ios7_common.h b/backends/platform/ios7/ios7_common.h
index fe79e6d6cc..73db72a068 100644
--- a/backends/platform/ios7/ios7_common.h
+++ b/backends/platform/ios7/ios7_common.h
@@ -107,7 +107,7 @@ extern char **iOS7_argv;
void iOS7_updateScreen();
bool iOS7_fetchEvent(InternalEvent *event);
-bool iOS7_isHighResDevice();
+bool iOS7_isBigDevice();
void iOS7_main(int argc, char **argv);
const char *iOS7_getDocumentsDir();
diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index a58aa10340..d8eb84e214 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -64,7 +64,7 @@ OSystem_iOS7::OSystem_iOS7() :
_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
_mouseCursorPaletteEnabled(false), _gfxTransactionError(kTransactionSuccess) {
_queuedInputEvent.type = Common::EVENT_INVALID;
- _touchpadModeEnabled = !iOS7_isHighResDevice();
+ _touchpadModeEnabled = !iOS7_isBigDevice();
#ifdef IPHONE_OFFICIAL
_fsFactory = new ChRootFilesystemFactory(iOS7_getDocumentsDir());
#else
diff --git a/backends/platform/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm
index e2ac189baa..f2f00069f9 100644
--- a/backends/platform/ios7/ios7_osys_video.mm
+++ b/backends/platform/ios7/ios7_osys_video.mm
@@ -38,7 +38,7 @@ const OSystem::GraphicsMode *OSystem_iOS7::getSupportedGraphicsModes() const {
}
int OSystem_iOS7::getDefaultGraphicsMode() const {
- return kGraphicsModeLinear;
+ return kGraphicsModeNone;
}
bool OSystem_iOS7::setGraphicsMode(int mode) {
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 1a2ae5ee91..191faa806b 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -54,8 +54,8 @@ int printOglError(const char *file, int line) {
return retCode;
}
-bool iOS7_isHighResDevice() {
- return g_fullHeight > 480;
+bool iOS7_isBigDevice() {
+ return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
}
void iOS7_updateScreen() {
@@ -129,22 +129,30 @@ uint getSizeNextPOT(uint size) {
NSLog(@"Failed to make complete framebuffer object %x.", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
return;
}
- uint maxValue = MAX(_renderBufferWidth, _renderBufferHeight), maxValuePOT = getSizeNextPOT(maxValue);
- uint minValue = MIN(_renderBufferWidth, _renderBufferHeight), minValuePOT = getSizeNextPOT(minValue);
+ uint overlayWidth = MAX(_renderBufferWidth, _renderBufferHeight);
+ uint overlayHeight = MIN(_renderBufferWidth, _renderBufferHeight);
+
+ if (!iOS7_isBigDevice()) {
+ // On small devices, we force the user interface to use the small theme
+ while (overlayHeight > 480) {
+ overlayWidth /= 2;
+ overlayHeight /= 2;
+ }
+ }
- _videoContext.overlayWidth = maxValue;
- _videoContext.overlayHeight = minValue;
+ _videoContext.overlayWidth = overlayWidth;
+ _videoContext.overlayHeight = overlayHeight;
- uint overlayTextureWidth = maxValuePOT;
- uint overlayTextureHeight = minValuePOT;
+ uint overlayTextureWidthPOT = getSizeNextPOT(overlayWidth);
+ uint overlayTextureHeightPOT = getSizeNextPOT(overlayHeight);
// Since the overlay size won't change the whole run, we can
// precalculate the texture coordinates for the overlay texture here
// and just use it later on.
- _overlayTexCoords[2] = _overlayTexCoords[6] = _videoContext.overlayWidth / (GLfloat)overlayTextureWidth;
- _overlayTexCoords[5] = _overlayTexCoords[7] = _videoContext.overlayHeight / (GLfloat)overlayTextureHeight;
+ _overlayTexCoords[2] = _overlayTexCoords[6] = _videoContext.overlayWidth / (GLfloat) overlayTextureWidthPOT;
+ _overlayTexCoords[5] = _overlayTexCoords[7] = _videoContext.overlayHeight / (GLfloat) overlayTextureHeightPOT;
- _videoContext.overlayTexture.create(overlayTextureWidth, overlayTextureHeight, Graphics::createPixelFormat<5551>());
+ _videoContext.overlayTexture.create(overlayTextureWidthPOT, overlayTextureHeightPOT, Graphics::createPixelFormat<5551>());
glViewport(0, 0, _renderBufferWidth, _renderBufferHeight); printOpenGLError();
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); printOpenGLError();
@@ -192,36 +200,6 @@ uint getSizeNextPOT(uint size) {
[doubleTapTwoFingers release];
}
-- (CGFloat)optimalScale {
- CGFloat screenScale = [[UIScreen mainScreen] scale];
- if (screenScale < 2) return screenScale;
-
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
- return 1;
- }
-
- CGSize screenSize;
- UIScreen *mainScreen = [UIScreen mainScreen];
- if ([mainScreen respondsToSelector:@selector(nativeBounds)]) {
- screenSize = [mainScreen nativeBounds].size;
- }
- else {
- screenSize = [mainScreen bounds].size;
- screenSize.width *= screenScale;
- screenSize.height *= screenScale;
- }
- CGFloat mxSize = MAX(screenSize.width, screenSize.height);
-
- if (mxSize <= 1136) {
- // iPhone 4S / 5 / 5S / 5C
- return 1;
- }
- else {
- // iPhone 6 / 6S / 6+ / 6S+
- return 2;
- }
-}
-
- (id)initWithFrame:(struct CGRect)frame {
self = [super initWithFrame: frame];
@@ -230,7 +208,7 @@ uint getSizeNextPOT(uint size) {
g_fullWidth = (int)MAX(frame.size.width, frame.size.height);
g_fullHeight = (int)MIN(frame.size.width, frame.size.height);
- _contentScaleFactor = [self optimalScale];
+ _contentScaleFactor = [[UIScreen mainScreen] scale];
[self setContentScaleFactor:_contentScaleFactor];
_keyboardView = nil;