diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-09-23 13:38:15 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:27:19 +0300 |
commit | 09e13c7196c8cd46d75230f59b1f1f0521abebc6 (patch) | |
tree | 7c75331e421e83b320a55e2ba59d84aa13f207f5 /iphone/Maps/Classes/EAGLView.mm | |
parent | 2d5f1fa4206518b6bb9d57aa1bc5b37b87fc9cf2 (diff) |
[core] iphone6+ scaling fix
Diffstat (limited to 'iphone/Maps/Classes/EAGLView.mm')
-rw-r--r-- | iphone/Maps/Classes/EAGLView.mm | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm index a0ecdb249c..a4a7bdc347 100644 --- a/iphone/Maps/Classes/EAGLView.mm +++ b/iphone/Maps/Classes/EAGLView.mm @@ -1,6 +1,8 @@ #import <QuartzCore/QuartzCore.h> #import <OpenGLES/EAGLDrawable.h> +#import "../Categories/UIKitCategories.h" + #import "EAGLView.h" #include "RenderBuffer.hpp" @@ -54,7 +56,7 @@ // Backbuffer : YES, (to prevent from loosing content when mixing with ordinary layers). eaglLayer.drawableProperties = @{kEAGLDrawablePropertyRetainedBacking : @NO, kEAGLDrawablePropertyColorFormat : kEAGLColorFormatRGB565}; // Correct retina display support in opengl renderbuffer - self.contentScaleFactor = [UIScreen mainScreen].scale; + self.contentScaleFactor = [self correctContentScale]; } NSLog(@"EAGLView initWithCoder Ended"); @@ -81,7 +83,7 @@ CGRect frameRect = screen.applicationFrame; CGRect screenRect = screen.bounds; - double vs = screen.scale; + double vs = self.contentScaleFactor; rpParams.m_screenWidth = screenRect.size.width * vs; rpParams.m_screenHeight = screenRect.size.height * vs; @@ -90,6 +92,8 @@ if (vs == 1.0) rpParams.m_density = graphics::EDensityMDPI; + else if (vs > 2.0) + rpParams.m_density = graphics::EDensityIPhone6Plus; else rpParams.m_density = graphics::EDensityXHDPI; @@ -146,6 +150,15 @@ screen->endFrame(); } +- (double)correctContentScale +{ + UIScreen * uiScreen = [UIScreen mainScreen]; + if (SYSTEM_VERSION_IS_LESS_THAN(@"8")) + return uiScreen.scale; + else + return uiScreen.nativeScale; +} + - (void)drawFrame { shared_ptr<PaintEvent> pe(new PaintEvent(renderPolicy->GetDrawer().get())); |