Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Eliminate UIScreenMode parameter from UIKit_AddDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
keestux committed Oct 18, 2011
1 parent 4e57f04 commit c1e71e0
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/video/uikit/SDL_uikitvideo.m
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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);
}
}
}
Expand Down

0 comments on commit c1e71e0

Please sign in to comment.