From bd68226eee6173b021d6549a055f5a76b314ca6a Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Thu, 15 Mar 2012 17:41:47 +0300 Subject: [PATCH] [ios] Fixed VisualScale for iPad3 support --- iphone/Maps/Classes/EAGLView.mm | 24 +++++------------------- platform/platform_ios.mm | 19 ++++++------------- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm index a223cde32b..e707d04275 100644 --- a/iphone/Maps/Classes/EAGLView.mm +++ b/iphone/Maps/Classes/EAGLView.mm @@ -41,7 +41,7 @@ eaglLayer.opaque = YES; renderContext = shared_ptr(new iphone::RenderContext()); - + if (!renderContext.get()) { [self release]; @@ -50,30 +50,16 @@ renderContext->makeCurrent(); - /// ColorFormat : RGB565 - /// Backbuffer : YES, (to prevent from loosing content when mixing with ordinary layers). + // ColorFormat : RGB565 + // Backbuffer : YES, (to prevent from loosing content when mixing with ordinary layers). eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGB565, kEAGLDrawablePropertyColorFormat, nil]; - - int etalonW = 320; - int scrW = etalonW; - - UIDevice * device = [UIDevice currentDevice]; - - float ver = [device.systemVersion floatValue]; - NSLog(@"%@", device.systemVersion); - /// rounding problems - if (ver >= 3.199) - { - UIScreen * mainScr = [UIScreen mainScreen]; - scrW = mainScr.currentMode.size.width; - if (scrW == 640) - self.contentScaleFactor = 2.0; - } + // Correct retina display support in opengl renderbuffer + self.contentScaleFactor = [[UIScreen mainScreen] scale]; } return self; diff --git a/platform/platform_ios.mm b/platform/platform_ios.mm index 22fe34bab5..75d5076525 100644 --- a/platform/platform_ios.mm +++ b/platform/platform_ios.mm @@ -54,20 +54,18 @@ Platform::Platform() m_tmpDir = [NSHomeDirectory() UTF8String]; m_tmpDir += "/tmp/"; - // Hardcoding screen resolution depending on the device we are running. - m_impl->m_visualScale = 1.0; - m_impl->m_skinName = "basic_mdpi.skn"; + m_impl->m_visualScale = [[UIScreen mainScreen] scale]; + if (m_impl->m_visualScale > 1.0) + m_impl->m_skinName = "basic_xhdpi.skn"; + else + m_impl->m_skinName = "basic_mdpi.skn"; + m_impl->m_videoMemoryLimit = 8 * 1024 * 1024; - // Calculating resolution UIDevice * device = [UIDevice currentDevice]; - NSRange range = [device.model rangeOfString:@"iPad"]; if (range.location != NSNotFound) - { m_impl->m_deviceName = "iPad"; - m_impl->m_visualScale = 1.3; - } else { range = [device.model rangeOfString:@"iPod"]; @@ -75,11 +73,6 @@ Platform::Platform() m_impl->m_deviceName = "iPod"; else m_impl->m_deviceName = "iPhone"; - if ([UIScreen mainScreen].currentMode.size.width == 640) - { - m_impl->m_visualScale = 2.0; - m_impl->m_skinName = "basic_xhdpi.skn"; - } } m_impl->m_scaleEtalonSize = 256 * 1.5 * m_impl->m_visualScale;