Create egl_get_video_size

This commit is contained in:
twinaphex 2015-11-19 15:21:04 +01:00
parent 5aedc1c4ca
commit 46fb98e21c
5 changed files with 24 additions and 64 deletions

View File

@ -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;
}
}

View File

@ -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

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */