Create RARCH_DISPLAY_CTL_VIEWPORT_INFO
This commit is contained in:
parent
d078682a3c
commit
f1a572822b
|
@ -742,7 +742,8 @@ static bool init_video(void)
|
|||
/* Force custom viewport to have sane parameters. */
|
||||
custom_vp->width = width;
|
||||
custom_vp->height = height;
|
||||
video_driver_viewport_info(custom_vp);
|
||||
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, custom_vp);
|
||||
}
|
||||
|
||||
video_driver_set_rotation(
|
||||
|
@ -841,13 +842,6 @@ void video_driver_set_texture_frame(const void *frame, bool rgb32,
|
|||
#endif
|
||||
}
|
||||
|
||||
bool video_driver_viewport_info(struct video_viewport *vp)
|
||||
{
|
||||
if (!current_video || !current_video->viewport_info)
|
||||
return false;
|
||||
current_video->viewport_info(video_driver_data, vp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
|
@ -1728,6 +1722,11 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
|
|||
return false;
|
||||
return video_driver_poke->get_current_software_framebuffer(
|
||||
video_driver_data, (struct retro_framebuffer *)data);
|
||||
case RARCH_DISPLAY_CTL_VIEWPORT_INFO:
|
||||
if (!current_video || !current_video->viewport_info)
|
||||
return false;
|
||||
current_video->viewport_info(video_driver_data, (struct video_viewport*)data);
|
||||
break;
|
||||
case RARCH_DISPLAY_CTL_NONE:
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -156,7 +156,8 @@ enum rarch_display_ctl_state
|
|||
RARCH_DISPLAY_CTL_GPU_RECORD_GET,
|
||||
RARCH_DISPLAY_CTL_GPU_RECORD_INIT,
|
||||
RARCH_DISPLAY_CTL_GPU_RECORD_DEINIT,
|
||||
RARCH_DISPLAY_CTL_GET_CURRENT_SOFTWARE_FRAMEBUFFER
|
||||
RARCH_DISPLAY_CTL_GET_CURRENT_SOFTWARE_FRAMEBUFFER,
|
||||
RARCH_DISPLAY_CTL_VIEWPORT_INFO
|
||||
};
|
||||
|
||||
typedef struct video_info
|
||||
|
@ -402,8 +403,6 @@ void video_driver_set_texture_enable(bool enable, bool full_screen);
|
|||
void video_driver_set_texture_frame(const void *frame, bool rgb32,
|
||||
unsigned width, unsigned height, float alpha);
|
||||
|
||||
bool video_driver_viewport_info(struct video_viewport *vp);
|
||||
|
||||
bool video_driver_set_shader(enum rarch_shader_type type,
|
||||
const char *path);
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ static void x_input_poll_mouse(x11_input_t *x11)
|
|||
int mid_w, mid_h;
|
||||
struct video_viewport vp = {0};
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
mid_w = vp.full_width >> 1;
|
||||
mid_h = vp.full_height >> 1;
|
||||
|
|
|
@ -369,7 +369,7 @@ bool input_translate_coord_viewport(int mouse_x, int mouse_y,
|
|||
int scaled_screen_x, scaled_screen_y, scaled_x, scaled_y;
|
||||
struct video_viewport vp = {0};
|
||||
|
||||
if (!video_driver_viewport_info(&vp))
|
||||
if (!video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp))
|
||||
return false;
|
||||
|
||||
scaled_screen_x = (2 * mouse_x * 0x7fff) / (int)vp.full_width - 0x7fff;
|
||||
|
|
|
@ -784,7 +784,7 @@ static int menu_input_mouse(unsigned *action)
|
|||
const struct retro_keybind *binds[MAX_USERS];
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
|
||||
if (!video_driver_viewport_info(&vp))
|
||||
if (!video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp))
|
||||
return -1;
|
||||
|
||||
if (menu_input->mouse.hwheeldown)
|
||||
|
|
|
@ -568,7 +568,7 @@ static int setting_uint_action_left_custom_viewport_width(void *data, bool wrapa
|
|||
if (!settings || !av_info)
|
||||
return -1;
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
if (custom->width <= 1)
|
||||
custom->width = 1;
|
||||
|
@ -595,7 +595,7 @@ static int setting_uint_action_right_custom_viewport_width(void *data, bool wrap
|
|||
if (!settings || !av_info)
|
||||
return -1;
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
if (settings->video.scale_integer)
|
||||
custom->width += geom->base_width;
|
||||
|
@ -620,7 +620,7 @@ static int setting_uint_action_left_custom_viewport_height(void *data, bool wrap
|
|||
if (!settings || !av_info)
|
||||
return -1;
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
if (custom->height <= 1)
|
||||
custom->height = 1;
|
||||
|
@ -647,7 +647,7 @@ static int setting_uint_action_right_custom_viewport_height(void *data, bool wra
|
|||
if (!settings || !av_info)
|
||||
return -1;
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
if (settings->video.scale_integer)
|
||||
custom->height += geom->base_height;
|
||||
|
@ -2158,7 +2158,7 @@ static int setting_action_start_custom_viewport_width(void *data)
|
|||
if (!settings || !av_info)
|
||||
return -1;
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
if (settings->video.scale_integer)
|
||||
custom->width = ((custom->width + geom->base_width - 1) /
|
||||
|
@ -2184,7 +2184,7 @@ static int setting_action_start_custom_viewport_height(void *data)
|
|||
if (!settings || !av_info)
|
||||
return -1;
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
if (settings->video.scale_integer)
|
||||
custom->height = ((custom->height + geom->base_height - 1) /
|
||||
|
@ -2855,7 +2855,7 @@ void general_write_handler(void *data)
|
|||
struct retro_game_geometry *geom = (struct retro_game_geometry*)
|
||||
&av_info->geometry;
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
if (*setting->value.boolean)
|
||||
{
|
||||
|
|
|
@ -192,7 +192,7 @@ void recording_dump_frame(const void *data, unsigned width,
|
|||
uint8_t *gpu_buf = NULL;
|
||||
struct video_viewport vp = {0};
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
if (!vp.width || !vp.height)
|
||||
{
|
||||
|
@ -350,7 +350,7 @@ bool recording_init(void)
|
|||
unsigned gpu_size;
|
||||
struct video_viewport vp = {0};
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
if (!vp.width || !vp.height)
|
||||
{
|
||||
|
|
|
@ -128,7 +128,7 @@ static bool take_screenshot_viewport(void)
|
|||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
video_driver_viewport_info(&vp);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_VIEWPORT_INFO, &vp);
|
||||
|
||||
if (!vp.width || !vp.height)
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue