forked from organicmaps/organicmaps
[core] iphone6+ scaling fix
This commit is contained in:
parent
2d5f1fa420
commit
09e13c7196
3 changed files with 20 additions and 5 deletions
|
@ -63,7 +63,8 @@ namespace graphics
|
|||
{EDensityMDPI, "mdpi"},
|
||||
{EDensityHDPI, "hdpi"},
|
||||
{EDensityXHDPI, "xhdpi"},
|
||||
{EDensityXXHDPI, "xxhdpi"}
|
||||
{EDensityXXHDPI, "xxhdpi"},
|
||||
{EDensityIPhone6Plus, "xhdpi"}
|
||||
};
|
||||
|
||||
char const * convert(EDensity density)
|
||||
|
@ -83,7 +84,7 @@ namespace graphics
|
|||
|
||||
double visualScale(EDensity density)
|
||||
{
|
||||
static double const vs [5] = { 0.75, 1, 1.5, 2, 3 };
|
||||
static double const vs [6] = { 0.75, 1, 1.5, 2, 3, 2.4 };
|
||||
return vs[density];
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ namespace graphics
|
|||
EDensityMDPI,
|
||||
EDensityHDPI,
|
||||
EDensityXHDPI,
|
||||
EDensityXXHDPI
|
||||
EDensityXXHDPI,
|
||||
EDensityIPhone6Plus
|
||||
};
|
||||
|
||||
/// get density name
|
||||
|
|
|
@ -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()));
|
||||
|
|
Loading…
Add table
Reference in a new issue