21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_UIKIT 47 if (uiscreenmode != nil) {
57 mode->
driverdata = (
void *) CFBridgingRetain(data);
73 UIScreenMode * uiscreenmode)
80 if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) {
89 UIKit_FreeDisplayModeData(&mode);
96 UIScreenMode * uiscreenmode,
SDL_bool addRotation)
98 if (UIKit_AddSingleDisplayMode(display, w, h, uiscreenmode) < 0) {
104 if (UIKit_AddSingleDisplayMode(display, h, w, uiscreenmode) < 0) {
113 UIKit_AddDisplay(UIScreen *uiscreen)
115 CGSize
size = uiscreen.bounds.size;
119 CGFloat
height = size.width;
120 size.width = size.height;
128 mode.
w = (int) size.width;
129 mode.
h = (
int) size.height;
131 UIScreenMode *uiscreenmode = uiscreen.currentMode;
133 if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) {
150 display.
driverdata = (
void *) CFBridgingRetain(data);
160 if (uiscreen == [UIScreen mainScreen]) {
161 return UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation);
165 CGSize size = uiscreen.bounds.size;
166 return (size.width > size.height);
174 for (UIScreen *uiscreen
in [UIScreen screens]) {
175 if (UIKit_AddDisplay(uiscreen) < 0) {
193 NSArray *availableModes = nil;
197 availableModes = @[data.uiscreen.currentMode];
199 availableModes = data.
uiscreen.availableModes;
205 if ([data.
uiscreen respondsToSelector:
@selector(nativeScale)]) {
210 for (UIScreenMode *uimode
in availableModes) {
213 int w = (int)(uimode.size.width / scale);
214 int h = (int)(uimode.size.height / scale);
217 if (isLandscape != (w > h)) {
223 UIKit_AddDisplayMode(display, w, h, uimode, addRotation);
236 [data.uiscreen setCurrentMode:modedata.uiscreenmode];
239 if (data.
uiscreen == [UIScreen mainScreen]) {
243 if (mode->
w > mode->
h) {
245 return SDL_SetError(
"Screen orientation does not match display mode size");
247 }
else if (mode->
w < mode->
h) {
249 return SDL_SetError(
"Screen orientation does not match display mode size");
275 frame = [data.uiscreen applicationFrame];
279 rect->
x += frame.origin.
x;
280 rect->
y += frame.origin.
y;
281 rect->
w = frame.size.width;
282 rect->
h = frame.size.height;
300 UIKit_FreeDisplayModeData(mode);
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)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
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 GLint GLsizei GLsizei height
void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
static SDL_VideoDevice * _this
GLint GLint GLint GLint GLint GLint y
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
SDL_VideoDisplay * displays
#define SDL_GetDisplayBounds
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
UIScreenMode * uiscreenmode
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
GLubyte GLubyte GLubyte GLubyte w
GLfloat GLfloat GLfloat GLfloat h
A rectangle, with the origin at the upper left.
int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)