diff --git a/gfx/common/egl_common.c b/gfx/common/egl_common.c index 977f90dfa7..d7bcc287f1 100644 --- a/gfx/common/egl_common.c +++ b/gfx/common/egl_common.c @@ -145,3 +145,19 @@ void egl_set_swap_interval(void *data, unsigned interval) egl_report_error(); } } + +void egl_get_video_size(void *data, unsigned *width, unsigned *height) +{ + *width = 0; + *height = 0; + + if (g_egl_dpy != EGL_NO_DISPLAY && g_egl_surf != EGL_NO_SURFACE) + { + EGLint gl_width, gl_height; + + eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width); + eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height); + *width = gl_width; + *height = gl_height; + } +} diff --git a/gfx/common/egl_common.h b/gfx/common/egl_common.h index 30a1a85da1..56abf3ab5c 100644 --- a/gfx/common/egl_common.h +++ b/gfx/common/egl_common.h @@ -43,4 +43,6 @@ void egl_swap_buffers(void *data); void egl_set_swap_interval(void *data, unsigned interval); +void egl_get_video_size(void *data, unsigned *width, unsigned *height); + #endif diff --git a/gfx/drivers_context/androidegl_ctx.c b/gfx/drivers_context/androidegl_ctx.c index 88dba246ab..b1bd45577a 100644 --- a/gfx/drivers_context/androidegl_ctx.c +++ b/gfx/drivers_context/androidegl_ctx.c @@ -38,25 +38,6 @@ static void android_gfx_ctx_destroy(void *data) egl_destroy(); } -static void android_gfx_ctx_get_video_size(void *data, - unsigned *width, unsigned *height) -{ - EGLint gl_width, gl_height; - - *width = 0; - *height = 0; - - if (!g_egl_dpy) - return; - - eglQuerySurface(g_egl_dpy, - g_egl_surf, EGL_WIDTH, &gl_width); - eglQuerySurface(g_egl_dpy, - g_egl_surf, EGL_HEIGHT, &gl_height); - *width = gl_width; - *height = gl_height; -} - static bool android_gfx_ctx_init(void *data) { int var; @@ -157,7 +138,7 @@ static void android_gfx_ctx_check_window(void *data, bool *quit, *quit = false; - android_gfx_ctx_get_video_size(data, &new_width, &new_height); + egl_get_video_size(data, &new_width, &new_height); if (new_width != *width || new_height != *height) { @@ -293,7 +274,7 @@ const gfx_ctx_driver_t gfx_ctx_android = { android_gfx_ctx_bind_api, egl_set_swap_interval, android_gfx_ctx_set_video_mode, - android_gfx_ctx_get_video_size, + egl_get_video_size, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ NULL, /* get_video_output_next */ diff --git a/gfx/drivers_context/bbqnx_ctx.c b/gfx/drivers_context/bbqnx_ctx.c index f2714cffe7..f21e97eacb 100644 --- a/gfx/drivers_context/bbqnx_ctx.c +++ b/gfx/drivers_context/bbqnx_ctx.c @@ -50,24 +50,6 @@ static void gfx_ctx_qnx_destroy(void *data) g_resize = false; } -static void gfx_ctx_qnx_get_video_size(void *data, unsigned *width, unsigned *height) -{ - EGLint gl_width, gl_height; - - (void)data; - - *width = 0; - *height = 0; - - if (!g_egl_dpy) - return; - - eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width); - eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height); - *width = gl_width; - *height = gl_height; -} - static bool gfx_ctx_qnx_init(void *data) { EGLint num_config; @@ -287,7 +269,7 @@ static void gfx_ctx_qnx_check_window(void *data, bool *quit, *quit = false; - gfx_ctx_qnx_get_video_size(data, &new_width, &new_height); + egl_get_video_size(data, &new_width, &new_height); if (new_width != *width || new_height != *height) { *width = new_width; @@ -378,7 +360,7 @@ const gfx_ctx_driver_t gfx_ctx_bbqnx = { gfx_ctx_qnx_bind_api, egl_set_swap_interval, gfx_ctx_qnx_set_video_mode, - gfx_ctx_qnx_get_video_size, + egl_get_video_size, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ NULL, /* get_video_output_next */ diff --git a/gfx/drivers_context/vivante_fbdev_ctx.c b/gfx/drivers_context/vivante_fbdev_ctx.c index dbfdeaad13..3081b21cc0 100644 --- a/gfx/drivers_context/vivante_fbdev_ctx.c +++ b/gfx/drivers_context/vivante_fbdev_ctx.c @@ -43,25 +43,6 @@ static void gfx_ctx_vivante_destroy(void *data) g_resize = false; } -static void gfx_ctx_vivante_get_video_size(void *data, - unsigned *width, unsigned *height) -{ - (void)data; - - *width = 0; - *height = 0; - - if (g_egl_dpy != EGL_NO_DISPLAY && g_egl_surf != EGL_NO_SURFACE) - { - EGLint gl_width, gl_height; - - eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width); - eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height); - *width = gl_width; - *height = gl_height; - } -} - static bool gfx_ctx_vivante_init(void *data) { EGLint num_config; @@ -125,9 +106,7 @@ static void gfx_ctx_vivante_check_window(void *data, bool *quit, { unsigned new_width, new_height; - (void)frame_count; - - gfx_ctx_vivante_get_video_size(data, &new_width, &new_height); + egl_get_video_size(data, &new_width, &new_height); if (new_width != *width || new_height != *height) { @@ -250,7 +229,7 @@ const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = { gfx_ctx_vivante_bind_api, egl_set_swap_interval, gfx_ctx_vivante_set_video_mode, - gfx_ctx_vivante_get_video_size, + egl_get_video_size, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ NULL, /* get_video_output_next */