21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_UIKIT 28 #include "../../events/SDL_events_c.h" 49 if (uiscreenmode != nil) {
59 mode->
driverdata = (
void *) CFBridgingRetain(data);
74 UIKit_GetDisplayModeRefreshRate(UIScreen *uiscreen)
77 if ([uiscreen respondsToSelector:
@selector(maximumFramesPerSecond)]) {
78 return uiscreen.maximumFramesPerSecond;
86 UIScreen * uiscreen, UIScreenMode * uiscreenmode)
91 if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) {
96 mode.
refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen);
103 UIKit_FreeDisplayModeData(&mode);
109 UIKit_AddDisplayMode(
SDL_VideoDisplay * display,
int w,
int h, UIScreen * uiscreen,
110 UIScreenMode * uiscreenmode,
SDL_bool addRotation)
112 if (UIKit_AddSingleDisplayMode(display, w, h, uiscreen, uiscreenmode) < 0) {
118 if (UIKit_AddSingleDisplayMode(display, h, w, uiscreen, uiscreenmode) < 0) {
127 UIKit_AddDisplay(UIScreen *uiscreen)
129 UIScreenMode *uiscreenmode = uiscreen.currentMode;
130 CGSize
size = uiscreen.bounds.size;
137 CGFloat
height = size.width;
138 size.width = size.height;
143 mode.
refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen);
144 mode.
w = (int) size.width;
145 mode.
h = (
int) size.height;
147 if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) {
164 display.
driverdata = (
void *) CFBridgingRetain(data);
174 if (uiscreen == [UIScreen mainScreen]) {
175 return UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation);
179 CGSize size = uiscreen.bounds.size;
180 return (size.width > size.height);
188 for (UIScreen *uiscreen
in [UIScreen screens]) {
189 if (UIKit_AddDisplay(uiscreen) < 0) {
210 NSArray *availableModes = nil;
214 availableModes = @[data.uiscreen.currentMode];
216 availableModes = data.
uiscreen.availableModes;
222 if ([data.
uiscreen respondsToSelector:
@selector(nativeScale)]) {
227 for (UIScreenMode *uimode
in availableModes) {
230 int w = (int)(uimode.size.width / scale);
231 int h = (int)(uimode.size.height / scale);
234 if (isLandscape != (w > h)) {
240 UIKit_AddDisplayMode(display, w, h, data.
uiscreen, uimode, addRotation);
253 [data.uiscreen setCurrentMode:modedata.uiscreenmode];
256 if (data.
uiscreen == [UIScreen mainScreen]) {
260 if (mode->
w > mode->
h) {
262 return SDL_SetError(
"Screen orientation does not match display mode size");
264 }
else if (mode->
w < mode->
h) {
266 return SDL_SetError(
"Screen orientation does not match display mode size");
289 #if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 291 frame = [data.uiscreen applicationFrame];
297 rect->
w =
frame.size.width;
298 rect->
h =
frame.size.height;
316 UIKit_FreeDisplayModeData(mode);
330 BOOL isLandscape = UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation);
342 if (isLandscape != (desktopmode->
w > desktopmode->
h)) {
344 desktopmode->
w = desktopmode->
h;
349 if (isLandscape != (currentmode->
w > currentmode->
h)) {
351 currentmode->
w = currentmode->
h;
355 switch ([UIApplication sharedApplication].statusBarOrientation) {
356 case UIInterfaceOrientationPortrait:
359 case UIInterfaceOrientationPortraitUpsideDown:
362 case UIInterfaceOrientationLandscapeLeft:
366 case UIInterfaceOrientationLandscapeRight:
int UIKit_InitModes(_THIS)
GLenum GLenum GLenum GLenum GLenum scale
SDL_bool UIKit_IsSystemVersionAtLeast(double version)
void UIKit_QuitModes(_THIS)
GLint GLint GLint GLint GLint x
SDL_bool UIKit_IsDisplayLandscape(UIScreen *uiscreen)
GLfloat GLfloat GLfloat GLfloat h
The structure that defines a display mode.
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld [DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp local skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
static SDL_VideoDevice * _this
SDL_VideoDisplay * SDL_GetDisplay(int displayIndex)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
SDL_DisplayMode * display_modes
SDL_DisplayMode current_mode
GLubyte GLubyte GLubyte GLubyte w
SDL_VideoDisplay * displays
#define SDL_GetDisplayBounds
GLint GLint GLint GLint GLint GLint y
int SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
int UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
#define SDL_OutOfMemory()
SDL_DisplayMode desktop_mode
GLint GLint GLsizei GLsizei height
UIScreenMode * uiscreenmode
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
void SDL_OnApplicationDidChangeStatusBarOrientation(void)
A rectangle, with the origin at the upper left.
int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)