From 1c5f6ab5f5535b71cbc0aad93c6f9e9cb8164819 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Mon, 4 Jun 2012 18:02:29 +0200 Subject: [PATCH] [ios] - fix retina support for iPad3 when not building with xcode4 and current ios sdk 5.1 --- xbmc/osx/ios/XBMCController.mm | 10 ++++++++++ xbmc/osx/ios/XBMCEAGLView.mm | 13 +++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/xbmc/osx/ios/XBMCController.mm b/xbmc/osx/ios/XBMCController.mm index 0d14fee7ac80a..98322eb4cea62 100644 --- a/xbmc/osx/ios/XBMCController.mm +++ b/xbmc/osx/ios/XBMCController.mm @@ -37,6 +37,7 @@ #include "utils/TimeUtils.h" #include "Util.h" #include "WinEventsIOS.h" +#include "osx/DarwinUtils.h" #undef BOOL #import "XBMCEAGLView.h" @@ -345,7 +346,16 @@ - (id)initWithFrame:(CGRect)frame /* Check if screen is Retina */ if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) + { screenScale = [[UIScreen mainScreen] scale]; + //if no retina display scale detected yet - + //ensure retina resolution on ipad3 + //even on older iOS SDKs + if (screenScale == 1.0 && DarwinIsIPad3()) + { + screenScale = 2.0; + } + } else screenScale = 1.0; diff --git a/xbmc/osx/ios/XBMCEAGLView.mm b/xbmc/osx/ios/XBMCEAGLView.mm index 8c13d663ef673..578775765ef84 100644 --- a/xbmc/osx/ios/XBMCEAGLView.mm +++ b/xbmc/osx/ios/XBMCEAGLView.mm @@ -34,6 +34,7 @@ #include "utils/log.h" #include "utils/TimeUtils.h" #include "Util.h" +#include "osx/DarwinUtils.h" #undef BOOL #import @@ -74,8 +75,16 @@ - (id)initWithFrame:(CGRect)frame if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { - eaglLayer.contentsScale = [[UIScreen mainScreen] scale]; - self.contentScaleFactor = [[UIScreen mainScreen] scale]; + CGFloat scale = [[UIScreen mainScreen] scale]; + //if no retina display scale detected yet - + //ensure retina resolution on ipad3 + //even on older iOS SDKs + if (scale == 1.0 && DarwinIsIPad3()) + { + scale = 2.0; + } + eaglLayer.contentsScale = scale; + self.contentScaleFactor = scale; } eaglLayer.opaque = TRUE; eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: