Add get_video_output_size callback to video context driver

This commit is contained in:
twinaphex 2015-02-24 19:58:14 +01:00
parent 07772e0e3a
commit aafc647724
17 changed files with 31 additions and 16 deletions

View File

@ -402,6 +402,7 @@ const gfx_ctx_driver_t gfx_ctx_apple = {
apple_gfx_ctx_set_video_mode,
apple_gfx_ctx_get_video_size,
NULL,
NULL,
apple_gfx_ctx_update_window_title,
apple_gfx_ctx_check_window,
apple_gfx_ctx_set_resize,

View File

@ -381,6 +381,7 @@ const gfx_ctx_driver_t gfx_ctx_android = {
android_gfx_ctx_set_video_mode,
android_gfx_ctx_get_video_size,
NULL,
NULL,
android_gfx_ctx_update_window_title,
android_gfx_ctx_check_window,
android_gfx_ctx_set_resize,

View File

@ -452,6 +452,7 @@ const gfx_ctx_driver_t gfx_ctx_bbqnx = {
gfx_ctx_qnx_set_video_mode,
gfx_ctx_qnx_get_video_size,
NULL,
NULL,
gfx_ctx_qnx_update_window_title,
gfx_ctx_qnx_check_window,
gfx_ctx_qnx_set_resize,

View File

@ -500,6 +500,7 @@ const gfx_ctx_driver_t gfx_ctx_d3d = {
NULL,
gfx_ctx_d3d_get_video_size,
NULL,
NULL,
gfx_ctx_d3d_update_title,
gfx_ctx_d3d_check_window,
d3d_resize,

View File

@ -958,6 +958,7 @@ const gfx_ctx_driver_t gfx_ctx_drm_egl = {
gfx_ctx_drm_egl_set_video_mode,
gfx_ctx_drm_egl_get_video_size,
NULL,
NULL,
gfx_ctx_drm_egl_update_window_title,
gfx_ctx_drm_egl_check_window,
gfx_ctx_drm_egl_set_resize,

View File

@ -308,6 +308,7 @@ const gfx_ctx_driver_t gfx_ctx_emscripten = {
gfx_ctx_emscripten_swap_interval,
gfx_ctx_emscripten_set_video_mode,
gfx_ctx_emscripten_get_video_size,
NULL,
gfx_ctx_emscripten_translate_aspect,
gfx_ctx_emscripten_update_window_title,
gfx_ctx_emscripten_check_window,

View File

@ -141,6 +141,7 @@ const gfx_ctx_driver_t gfx_ctx_null = {
gfx_ctx_null_set_video_mode,
gfx_ctx_null_get_video_size,
NULL,
NULL,
gfx_ctx_null_update_window_title,
gfx_ctx_null_check_window,
gfx_ctx_null_set_resize,

View File

@ -734,6 +734,7 @@ const gfx_ctx_driver_t gfx_ctx_glx = {
gfx_ctx_glx_set_video_mode,
gfx_ctx_glx_get_video_size,
NULL,
NULL,
gfx_ctx_glx_update_window_title,
gfx_ctx_glx_check_window,
gfx_ctx_glx_set_resize,

View File

@ -319,6 +319,7 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
gfx_ctx_mali_fbdev_set_video_mode,
gfx_ctx_mali_fbdev_get_video_size,
NULL,
NULL,
gfx_ctx_mali_fbdev_update_window_title,
gfx_ctx_mali_fbdev_check_window,
gfx_ctx_mali_fbdev_set_resize,

View File

@ -47,22 +47,6 @@ typedef struct gfx_ctx_ps3_data
#endif
} gfx_ctx_ps3_data_t;
static unsigned gfx_ctx_ps3_get_resolution_width(unsigned resolution_id)
{
CellVideoOutResolution resolution;
cellVideoOutGetResolution(resolution_id, &resolution);
return resolution.width;
}
static unsigned gfx_ctx_ps3_get_resolution_height(unsigned resolution_id)
{
CellVideoOutResolution resolution;
cellVideoOutGetResolution(resolution_id, &resolution);
return resolution.height;
}
static float gfx_ctx_ps3_get_aspect_ratio(void *data)
{
CellVideoOutState videoState;
@ -240,6 +224,19 @@ static void gfx_ctx_ps3_get_video_size(void *data,
#endif
}
static void gfx_ctx_ps3_get_video_output_size(void *data,
unsigned *width, unsigned *height)
{
if (!width || !height)
return;
CellVideoOutResolution resolution;
cellVideoOutGetResolution(resolution_id, &resolution);
*width = resolution.width;
*height = resolution.height;
}
static bool gfx_ctx_ps3_init(void *data)
{
gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)
@ -379,6 +376,7 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
gfx_ctx_ps3_set_swap_interval,
gfx_ctx_ps3_set_video_mode,
gfx_ctx_ps3_get_video_size,
gfx_ctx_ps3_get_video_output_size,
NULL,
gfx_ctx_ps3_update_window_title,
gfx_ctx_ps3_check_window,

View File

@ -421,6 +421,7 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl =
sdl_ctx_swap_interval,
sdl_ctx_set_video_mode,
sdl_ctx_get_video_size,
NULL, /* get_video_output_size */
NULL, /* translate_aspect */
sdl_ctx_update_window_title,
sdl_ctx_check_window,

View File

@ -640,6 +640,7 @@ const gfx_ctx_driver_t gfx_ctx_videocore = {
gfx_ctx_vc_swap_interval,
gfx_ctx_vc_set_video_mode,
gfx_ctx_vc_get_video_size,
NULL,
gfx_ctx_vc_translate_aspect,
gfx_ctx_vc_update_window_title,
gfx_ctx_vc_check_window,

View File

@ -304,6 +304,7 @@ const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = {
gfx_ctx_vivante_set_video_mode,
gfx_ctx_vivante_get_video_size,
NULL,
NULL,
gfx_ctx_vivante_update_window_title,
gfx_ctx_vivante_check_window,
gfx_ctx_vivante_set_resize,

View File

@ -881,6 +881,7 @@ const gfx_ctx_driver_t gfx_ctx_wayland = {
gfx_ctx_wl_set_video_mode,
gfx_ctx_wl_get_video_size,
NULL,
NULL,
gfx_ctx_wl_update_window_title,
gfx_ctx_wl_check_window,
gfx_ctx_wl_set_resize,

View File

@ -685,6 +685,7 @@ const gfx_ctx_driver_t gfx_ctx_wgl = {
gfx_ctx_wgl_set_video_mode,
gfx_ctx_wgl_get_video_size,
NULL,
NULL,
gfx_ctx_wgl_update_window_title,
gfx_ctx_wgl_check_window,
gfx_ctx_wgl_set_resize,

View File

@ -800,6 +800,7 @@ const gfx_ctx_driver_t gfx_ctx_x_egl = {
gfx_ctx_xegl_set_video_mode,
gfx_ctx_xegl_get_video_size,
NULL,
NULL,
gfx_ctx_xegl_update_window_title,
gfx_ctx_xegl_check_window,
gfx_ctx_xegl_set_resize,

View File

@ -70,6 +70,8 @@ typedef struct gfx_ctx_driver
* If not initialized yet, it returns current screen size. */
void (*get_video_size)(void*, unsigned*, unsigned*);
void (*get_video_output_size)(void*, unsigned*, unsigned*);
/* Translates a window size to an aspect ratio.
* In most cases this will be just width / height, but
* some contexts will better know which actual aspect ratio is used.