Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Eliminate UIScreenMode parameter from UIKit_AddDisplay

  • Loading branch information
keestux committed Oct 18, 2011
1 parent 4e57f04 commit c1e71e0428221693822bf07c24acb2e1e5df48da
Showing with 11 additions and 8 deletions.
  1. +11 −8 src/video/uikit/SDL_uikitvideo.m
@@ -166,7 +166,7 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)


static void
UIKit_AddDisplay(UIScreen *uiscreen, UIScreenMode *uimode, int w, int h)
UIKit_AddDisplay(UIScreen *uiscreen, int w, int h)
{
SDL_VideoDisplay display;
SDL_DisplayMode mode;
@@ -176,9 +176,14 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
mode.h = h;
mode.refresh_rate = 0;

[uimode retain]; // once for the desktop_mode
[uimode retain]; // once for the current_mode
mode.driverdata = uimode;
// UIScreenMode showed up in 3.2 (the iPad and later). We're
// misusing this supports_multiple_displays flag here for that.
if (!SDL_UIKit_supports_multiple_displays) {
UIScreenMode *uimode = [uiscreen currentMode];
[uimode retain]; // once for the desktop_mode
[uimode retain]; // once for the current_mode
mode.driverdata = uimode;
}

SDL_zero(display);
display.desktop_mode = mode;
@@ -202,9 +207,8 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)

// Add the main screen.
UIScreen *uiscreen = [UIScreen mainScreen];
UIScreenMode *uiscreenmode = [uiscreen currentMode];
const CGSize size = [uiscreen bounds].size;
UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
UIKit_AddDisplay(uiscreen, (int)size.width, (int)size.height);

// If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels.
// The iPad added both a larger main screen and the ability to use
@@ -213,9 +217,8 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
for (UIScreen *uiscreen in [UIScreen screens]) {
// Only add the other screens
if (uiscreen != [UIScreen mainScreen]) {
UIScreenMode *uiscreenmode = [uiscreen currentMode];
const CGSize size = [uiscreen bounds].size;
UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
UIKit_AddDisplay(uiscreen, (int)size.width, (int)size.height);
}
}
}

0 comments on commit c1e71e0

Please sign in to comment.