(SDL2) Cleanups
This commit is contained in:
parent
4109768a9a
commit
4d538a95f2
|
@ -173,7 +173,8 @@ static void sdl2_render_msg(sdl2_video_t *vid, const char *msg)
|
|||
for (; *msg; msg++)
|
||||
{
|
||||
int off_x, off_y, tex_x, tex_y;
|
||||
const struct font_glyph *gly = vid->font_driver->get_glyph(vid->font_data, (uint8_t)*msg);
|
||||
const struct font_glyph *gly =
|
||||
vid->font_driver->get_glyph(vid->font_data, (uint8_t)*msg);
|
||||
|
||||
if (!gly)
|
||||
gly = vid->font_driver->get_glyph(vid->font_data, '?');
|
||||
|
@ -197,7 +198,8 @@ static void sdl2_render_msg(sdl2_video_t *vid, const char *msg)
|
|||
(int)gly->width, (int)gly->height
|
||||
};
|
||||
|
||||
SDL_RenderCopyEx(vid->renderer, vid->font.tex, &srcrect, &dstrect, 0, NULL, SDL_FLIP_NONE);
|
||||
SDL_RenderCopyEx(vid->renderer, vid->font.tex,
|
||||
&srcrect, &dstrect, 0, NULL, SDL_FLIP_NONE);
|
||||
|
||||
delta_x += gly->advance_x;
|
||||
delta_y -= gly->advance_y;
|
||||
|
@ -284,11 +286,13 @@ static void sdl_refresh_viewport(sdl2_video_t *vid)
|
|||
vid->vp.full_height = win_h;
|
||||
|
||||
if (settings->video.scale_integer)
|
||||
video_viewport_get_scaled_integer(&vid->vp, win_w, win_h, video_driver_get_aspect_ratio(),
|
||||
vid->video.force_aspect);
|
||||
video_viewport_get_scaled_integer(&vid->vp,
|
||||
win_w, win_h, video_driver_get_aspect_ratio(),
|
||||
vid->video.force_aspect);
|
||||
else if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
const struct video_viewport *custom = (const struct video_viewport*)video_viewport_get_custom();
|
||||
const struct video_viewport *custom =
|
||||
(const struct video_viewport*)video_viewport_get_custom();
|
||||
|
||||
if (custom)
|
||||
{
|
||||
|
@ -330,7 +334,7 @@ static void sdl_refresh_viewport(sdl2_video_t *vid)
|
|||
}
|
||||
|
||||
static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32,
|
||||
unsigned width, unsigned height, unsigned pitch)
|
||||
unsigned width, unsigned height, unsigned pitch)
|
||||
{
|
||||
sdl2_tex_t *target = menu ? &vid->menu : &vid->frame;
|
||||
|
||||
|
@ -376,7 +380,8 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32,
|
|||
}
|
||||
}
|
||||
|
||||
static void *sdl2_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||
static void *sdl2_gfx_init(const video_info_t *video,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
int i;
|
||||
unsigned flags;
|
||||
|
@ -437,7 +442,7 @@ static void *sdl2_gfx_init(const video_info_t *video, const input_driver_t **inp
|
|||
goto error;
|
||||
}
|
||||
|
||||
vid->video = *video;
|
||||
vid->video = *video;
|
||||
vid->video.smooth = settings->video.smooth;
|
||||
vid->should_resize = true;
|
||||
|
||||
|
@ -452,7 +457,7 @@ static void *sdl2_gfx_init(const video_info_t *video, const input_driver_t **inp
|
|||
|
||||
sdl2_gfx_set_handles(vid);
|
||||
|
||||
*input = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
|
||||
return vid;
|
||||
|
@ -638,7 +643,7 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer)
|
|||
return true;
|
||||
}
|
||||
|
||||
void sdl2_poke_set_filtering(void *data, unsigned index, bool smooth)
|
||||
static void sdl2_poke_set_filtering(void *data, unsigned index, bool smooth)
|
||||
{
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
vid->video.smooth = smooth;
|
||||
|
@ -678,14 +683,14 @@ static void sdl2_poke_set_aspect_ratio(void *data, unsigned aspectratio_index)
|
|||
vid->should_resize = true;
|
||||
}
|
||||
|
||||
void sdl2_poke_apply_state_changes(void *data)
|
||||
static void sdl2_poke_apply_state_changes(void *data)
|
||||
{
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
vid->should_resize = true;
|
||||
}
|
||||
|
||||
void sdl2_poke_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
unsigned width, unsigned height, float alpha)
|
||||
static void sdl2_poke_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
unsigned width, unsigned height, float alpha)
|
||||
{
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
|
||||
|
@ -703,27 +708,28 @@ void sdl2_poke_set_texture_frame(void *data, const void *frame, bool rgb32,
|
|||
}
|
||||
}
|
||||
|
||||
void sdl2_poke_texture_enable(void *data, bool enable, bool full_screen)
|
||||
static void sdl2_poke_texture_enable(void *data, bool enable, bool full_screen)
|
||||
{
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
|
||||
vid->menu.active = enable;
|
||||
}
|
||||
|
||||
void sdl2_poke_set_osd_msg(void *data, const char *msg, const struct font_params *params, void *font)
|
||||
static void sdl2_poke_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
{
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
sdl2_render_msg(vid, msg);
|
||||
fprintf(stderr, "[SDL]: OSD MSG: %s\n", msg);
|
||||
RARCH_LOG("[SDL]: OSD MSG: %s\n", msg);
|
||||
}
|
||||
|
||||
void sdl2_show_mouse(void *data, bool state)
|
||||
static void sdl2_show_mouse(void *data, bool state)
|
||||
{
|
||||
(void)data;
|
||||
SDL_ShowCursor(state);
|
||||
}
|
||||
|
||||
void sdl2_grab_mouse_toggle(void *data)
|
||||
static void sdl2_grab_mouse_toggle(void *data)
|
||||
{
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
SDL_SetWindowGrab(vid->window, SDL_GetWindowGrab(vid->window));
|
||||
|
@ -758,7 +764,7 @@ static video_poke_interface_t sdl2_video_poke_interface = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
void sdl2_gfx_poke_interface(void *data, const video_poke_interface_t **iface)
|
||||
static void sdl2_gfx_poke_interface(void *data, const video_poke_interface_t **iface)
|
||||
{
|
||||
(void)data;
|
||||
*iface = &sdl2_video_poke_interface;
|
||||
|
|
Loading…
Reference in New Issue