mirror of
https://github.com/libretro/RetroArch
synced 2025-04-23 11:43:20 +00:00
Improve resize handling on Android.
This commit is contained in:
parent
2ceb46cd02
commit
71505ccb87
@ -34,6 +34,7 @@ static EGLContext g_egl_ctx;
|
|||||||
static EGLSurface g_egl_surf;
|
static EGLSurface g_egl_surf;
|
||||||
static EGLDisplay g_egl_dpy;
|
static EGLDisplay g_egl_dpy;
|
||||||
static EGLConfig g_config;
|
static EGLConfig g_config;
|
||||||
|
static bool g_resize;
|
||||||
|
|
||||||
GLfloat _angle;
|
GLfloat _angle;
|
||||||
|
|
||||||
@ -57,6 +58,7 @@ static void gfx_ctx_destroy(void)
|
|||||||
g_egl_surf = EGL_NO_SURFACE;
|
g_egl_surf = EGL_NO_SURFACE;
|
||||||
g_egl_ctx = EGL_NO_CONTEXT;
|
g_egl_ctx = EGL_NO_CONTEXT;
|
||||||
g_config = 0;
|
g_config = 0;
|
||||||
|
g_resize = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
|
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
|
||||||
@ -80,24 +82,13 @@ static void gfx_ctx_orientation_update(void)
|
|||||||
if (!gl)
|
if (!gl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get real known video size, which might have been altered by context.
|
unsigned width = 0, height = 0;
|
||||||
gfx_ctx_get_video_size(&gl->win_width, &gl->win_height);
|
gfx_ctx_get_video_size(&width, &height);
|
||||||
RARCH_LOG("GL: Using resolution %ux%u\n", gl->win_width, gl->win_height);
|
gl->full_x = width;
|
||||||
|
gl->full_y = height;
|
||||||
|
RARCH_LOG("GL: New orientation %ux%u\n", width, height);
|
||||||
|
|
||||||
if (gl->full_x || gl->full_y) // We got bogus from gfx_ctx_get_video_size. Replace.
|
g_resize = true;
|
||||||
{
|
|
||||||
gl->full_x = gl->win_width;
|
|
||||||
gl->full_y = gl->win_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_GLSL
|
|
||||||
gl_glsl_use(0);
|
|
||||||
#endif
|
|
||||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
|
||||||
#ifdef HAVE_GLSL
|
|
||||||
gl_glsl_use(1);
|
|
||||||
#endif
|
|
||||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool gfx_ctx_init(void)
|
static bool gfx_ctx_init(void)
|
||||||
@ -192,15 +183,16 @@ static void gfx_ctx_swap_buffers(void)
|
|||||||
static void gfx_ctx_check_window(bool *quit,
|
static void gfx_ctx_check_window(bool *quit,
|
||||||
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
||||||
{
|
{
|
||||||
(void)width;
|
|
||||||
(void)height;
|
|
||||||
(void)frame_count;
|
(void)frame_count;
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
struct android_app* android_app = g_android.app;
|
struct android_app* android_app = g_android.app;
|
||||||
|
|
||||||
*quit = false;
|
*quit = false;
|
||||||
*resize = false;
|
|
||||||
|
*resize = g_resize;
|
||||||
|
g_resize = false;
|
||||||
|
gfx_ctx_get_video_size(width, height);
|
||||||
|
|
||||||
RARCH_PERFORMANCE_INIT(alooper_pollonce);
|
RARCH_PERFORMANCE_INIT(alooper_pollonce);
|
||||||
RARCH_PERFORMANCE_START(alooper_pollonce);
|
RARCH_PERFORMANCE_START(alooper_pollonce);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user