1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00

Prevent implicit memsets with struct video_viewport

This commit is contained in:
twinaphex 2017-04-15 19:43:52 +02:00
parent e3fce81097
commit 7f4b490fdb
10 changed files with 147 additions and 32 deletions

View File

@ -677,15 +677,25 @@ static void d3d_calculate_rect(void *data,
if (settings->video.scale_integer && !force_full)
{
struct video_viewport vp = {0};
struct video_viewport vp;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
video_viewport_get_scaled_integer(&vp,
*width,
*height,
video_driver_get_aspect_ratio(), d3d->keep_aspect);
*x = vp.x;
*y = vp.y;
*width = vp.width;
*height = vp.height;
video_driver_get_aspect_ratio(),
d3d->keep_aspect);
*x = vp.x;
*y = vp.y;
*width = vp.width;
*height = vp.height;
}
else if (d3d->keep_aspect && !force_full)
{

View File

@ -1273,9 +1273,20 @@ bool input_wl_state_kb(gfx_ctx_wayland_data_t *wl, const struct retro_keybind **
static int16_t input_wl_pointer_state(gfx_ctx_wayland_data_t *wl,
unsigned idx, unsigned id, bool screen)
{
bool inside = false;
struct video_viewport vp = {0};
int16_t res_x = 0, res_y = 0, res_screen_x = 0, res_screen_y = 0;
struct video_viewport vp;
bool inside = false;
int16_t res_x = 0;
int16_t res_y = 0;
int16_t res_screen_x = 0;
int16_t res_screen_y = 0;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
if (!(video_driver_translate_coord_viewport_wrap(&vp, wl->mouse.x, wl->mouse.y,
&res_x, &res_y, &res_screen_x, &res_screen_y)))

View File

@ -732,10 +732,17 @@ static INLINE int android_input_poll_event_type_motion(
for (motion_ptr = 0; motion_ptr < pointer_max; motion_ptr++)
{
struct video_viewport vp = {0};
struct video_viewport vp;
float x = AMotionEvent_getX(event, motion_ptr);
float y = AMotionEvent_getY(event, motion_ptr);
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
video_driver_translate_coord_viewport_wrap(
&vp,
x, y,

View File

@ -157,7 +157,15 @@ static void cocoa_input_poll(void *data)
for (i = 0; i < apple->touch_count; i++)
{
struct video_viewport vp = {0};
struct video_viewport vp;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
#ifndef IOS
apple->touches[i].screen_x *= backing_scale_factor;
apple->touches[i].screen_y *= backing_scale_factor;

View File

@ -405,12 +405,25 @@ static int16_t dinput_mouse_state_screen(struct dinput_input *di, unsigned id)
static int16_t dinput_pointer_state(struct dinput_input *di,
unsigned idx, unsigned id, bool screen)
{
bool pointer_down, inside;
int x, y;
struct video_viewport vp = {0};
int16_t res_x = 0, res_y = 0, res_screen_x = 0, res_screen_y = 0;
unsigned num = 0;
struct pointer_status *check_pos = di->pointer_head.next;
struct video_viewport vp;
bool pointer_down = false;
bool inside = false;
int x = 0;
int y = 0;
int16_t res_x = 0;
int16_t res_y = 0;
int16_t res_screen_x = 0;
int16_t res_screen_y = 0;
unsigned num = 0;
struct pointer_status *
check_pos = di->pointer_head.next;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
while (check_pos && num < idx)
{

View File

@ -409,9 +409,16 @@ static void qnx_process_touch_event(
{
if(qnx->pointer[i].contact_id == -1)
{
struct video_viewport vp = {0};
struct video_viewport vp;
qnx->pointer[i].contact_id = contact_id;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
qnx->pointer[i].contact_id = contact_id;
video_driver_translate_coord_viewport_wrap(
&vp,
@ -469,7 +476,15 @@ static void qnx_process_touch_event(
{
if(qnx->pointer[i].contact_id == contact_id)
{
struct video_viewport vp = {0};
struct video_viewport vp;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
#if 0
gl_t *gl = (gl_t*)video_driver_get_ptr(false);

View File

@ -177,9 +177,19 @@ static int16_t sdl_mouse_device_state(sdl_input_t *sdl, unsigned id)
static int16_t sdl_pointer_device_state(sdl_input_t *sdl,
unsigned idx, unsigned id, bool screen)
{
bool inside = false;
struct video_viewport vp = {0};
int16_t res_x = 0, res_y = 0, res_screen_x = 0, res_screen_y = 0;
struct video_viewport vp;
bool inside = false;
int16_t res_x = 0;
int16_t res_y = 0;
int16_t res_screen_x = 0;
int16_t res_screen_y = 0;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
if (!(video_driver_translate_coord_viewport_wrap(&vp, sdl->mouse_abs_x, sdl->mouse_abs_y,
&res_x, &res_y, &res_screen_x, &res_screen_y)))

View File

@ -461,9 +461,19 @@ static int16_t udev_analog_pressed(const struct retro_keybind *binds, unsigned i
static int16_t udev_pointer_state(udev_input_t *udev,
unsigned idx, unsigned id, bool screen)
{
bool inside = false;
struct video_viewport vp = {0};
int16_t res_x = 0, res_y = 0, res_screen_x = 0, res_screen_y = 0;
struct video_viewport vp;
bool inside = false;
int16_t res_x = 0;
int16_t res_y = 0;
int16_t res_screen_x = 0;
int16_t res_screen_y = 0;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
if (!(video_driver_translate_coord_viewport_wrap(&vp, udev->mouse_x, udev->mouse_y,
&res_x, &res_y, &res_screen_x, &res_screen_y)))

View File

@ -163,9 +163,19 @@ static int16_t x_mouse_state_screen(x11_input_t *x11, unsigned id)
static int16_t x_pointer_state(x11_input_t *x11,
unsigned idx, unsigned id, bool screen)
{
bool inside;
struct video_viewport vp = {0};
int16_t res_x = 0, res_y = 0, res_screen_x = 0, res_screen_y = 0;
struct video_viewport vp;
bool inside = false;
int16_t res_x = 0;
int16_t res_y = 0;
int16_t res_screen_x = 0;
int16_t res_screen_y = 0;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
if (!(video_driver_translate_coord_viewport_wrap(&vp, x11->mouse_x, x11->mouse_y,
&res_x, &res_y, &res_screen_x, &res_screen_y)))
@ -303,7 +313,14 @@ static void x_input_poll_mouse(x11_input_t *x11)
if (x11->grab_mouse && video_driver_is_focused())
{
int mid_w, mid_h;
struct video_viewport vp = {0};
struct video_viewport vp;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
video_driver_get_viewport_info(&vp);

View File

@ -200,7 +200,14 @@ void recording_dump_frame(const void *data, unsigned width,
if (has_gpu_record)
{
struct video_viewport vp = {0};
struct video_viewport vp;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
video_driver_get_viewport_info(&vp);
@ -357,7 +364,14 @@ bool recording_init(void)
if (video_driver_supports_recording())
{
unsigned gpu_size;
struct video_viewport vp = {0};
struct video_viewport vp;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
video_driver_get_viewport_info(&vp);