mirror of
https://github.com/libretro/RetroArch
synced 2025-03-23 19:21:03 +00:00
(iOS) Cache scale variable in hot function (touch) and some more cleanups
This commit is contained in:
parent
2a0028b7b4
commit
69cff98158
@ -234,21 +234,17 @@ CGFloat apple_gfx_ctx_get_native_scale(void)
|
|||||||
if (!screen)
|
if (!screen)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
(void)selector;
|
if ([screen respondsToSelector:selector])
|
||||||
|
|
||||||
#ifdef IOS
|
|
||||||
if ([[UIScreen mainScreen] respondsToSelector:selector])
|
|
||||||
{
|
{
|
||||||
float ret;
|
float ret;
|
||||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
|
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
|
||||||
[[[UIScreen mainScreen] class] instanceMethodSignatureForSelector:selector]];
|
[[screen class] instanceMethodSignatureForSelector:selector]];
|
||||||
[invocation setSelector:selector];
|
[invocation setSelector:selector];
|
||||||
[invocation setTarget:[UIScreen mainScreen]];
|
[invocation setTarget:screen];
|
||||||
[invocation invoke];
|
[invocation invoke];
|
||||||
[invocation getReturnValue:&ret];
|
[invocation getReturnValue:&ret];
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return screen.scale;
|
return screen.scale;
|
||||||
}
|
}
|
||||||
@ -258,7 +254,10 @@ static void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned*
|
|||||||
RAScreen *screen = (RAScreen*)get_chosen_screen();
|
RAScreen *screen = (RAScreen*)get_chosen_screen();
|
||||||
CGRect size = screen.bounds;
|
CGRect size = screen.bounds;
|
||||||
gl_t *gl = (gl_t*)data;
|
gl_t *gl = (gl_t*)data;
|
||||||
CGFloat screenscale = apple_gfx_ctx_get_native_scale();
|
static CGFloat screenscale = 0.0f;
|
||||||
|
|
||||||
|
if (screenscale == 0.0f)
|
||||||
|
screenscale = apple_gfx_ctx_get_native_scale();
|
||||||
|
|
||||||
if (gl)
|
if (gl)
|
||||||
{
|
{
|
||||||
|
@ -90,10 +90,12 @@ static void handle_touch_event(NSArray* touches)
|
|||||||
{
|
{
|
||||||
NSUInteger i;
|
NSUInteger i;
|
||||||
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
|
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
|
||||||
const float scale = apple_gfx_ctx_get_native_scale();
|
static CGFloat scale = 0.0f;
|
||||||
|
|
||||||
if (!apple)
|
if (!apple)
|
||||||
return;
|
return;
|
||||||
|
if (scale == 0.0f)
|
||||||
|
scale = apple_gfx_ctx_get_native_scale();
|
||||||
|
|
||||||
apple->touch_count = 0;
|
apple->touch_count = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user