Create video_driver_set_size

This commit is contained in:
twinaphex 2015-11-23 12:54:15 +01:00
parent 5854f83d19
commit 86504392b9
6 changed files with 17 additions and 40 deletions

View File

@ -177,9 +177,7 @@ void d3d_make_d3dpp(void *data,
unsigned height = 0; unsigned height = 0;
gfx_ctx_get_video_size(d3d, &width, &height); gfx_ctx_get_video_size(d3d, &width, &height);
video_driver_set_size(&width, &height);
video_driver_set_size_width(width);
video_driver_set_size_height(height);
#endif #endif
video_driver_get_size(&d3dpp->BackBufferWidth, &d3dpp->BackBufferHeight); video_driver_get_size(&d3dpp->BackBufferWidth, &d3dpp->BackBufferHeight);
} }
@ -464,10 +462,7 @@ static bool d3d_alive(void *data)
} }
if (temp_width != 0 && temp_height != 0) if (temp_width != 0 && temp_height != 0)
{ video_driver_set_size(&temp_width, &temp_height);
video_driver_set_size_width(temp_width);
video_driver_set_size_height(temp_height);
}
return ret; return ret;
} }
@ -602,8 +597,9 @@ static bool d3d_construct(d3d_video_t *d3d,
#else #else
gfx_ctx_get_video_size(d3d, &full_x, &full_y); gfx_ctx_get_video_size(d3d, &full_x, &full_y);
#endif #endif
video_driver_set_size_width(info->fullscreen ? full_x : info->width); video_driver_set_size(
video_driver_set_size_height(info->fullscreen ? full_y : info->height); info->fullscreen ? &full_x : &info->width,
info->fullscreen ? &full_y : &info->height);
#ifndef _XBOX #ifndef _XBOX
#ifdef HAVE_WINDOW #ifdef HAVE_WINDOW

View File

@ -2481,10 +2481,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
gfx_ctx_get_video_size(gl, &temp_width, &temp_height); gfx_ctx_get_video_size(gl, &temp_width, &temp_height);
if (temp_width != 0 && temp_height != 0) if (temp_width != 0 && temp_height != 0)
{ video_driver_set_size(&temp_width, &temp_height);
video_driver_set_size_width(temp_width);
video_driver_set_size_height(temp_height);
}
video_driver_get_size(&temp_width, &temp_height); video_driver_get_size(&temp_width, &temp_height);
@ -2660,10 +2657,7 @@ static bool gl_alive(void *data)
} }
if (temp_width != 0 && temp_height != 0) if (temp_width != 0 && temp_height != 0)
{ video_driver_set_size(&temp_width, &temp_height);
video_driver_set_size_width(temp_width);
video_driver_set_size_height(temp_height);
}
return ret; return ret;
} }

View File

@ -104,10 +104,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
RARCH_LOG("Detecting screen resolution %ux%u.\n", temp_width, temp_height); RARCH_LOG("Detecting screen resolution %ux%u.\n", temp_width, temp_height);
if (temp_width != 0 && temp_height != 0) if (temp_width != 0 && temp_height != 0)
{ video_driver_set_size(&temp_width, &temp_height);
video_driver_set_size_width(temp_width);
video_driver_set_size_width(temp_height);
}
gfx_ctx_swap_interval(vg, video->vsync ? 1 : 0); gfx_ctx_swap_interval(vg, video->vsync ? 1 : 0);
@ -139,8 +136,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
if (temp_width != 0 && temp_height != 0) if (temp_width != 0 && temp_height != 0)
{ {
RARCH_LOG("Verified window resolution %ux%u.\n", temp_width, temp_height); RARCH_LOG("Verified window resolution %ux%u.\n", temp_width, temp_height);
video_driver_set_size_width(temp_width); video_driver_set_size(&temp_width, &temp_height);
video_driver_set_size_height(temp_height);
} }
video_driver_get_size(&temp_width, &temp_height); video_driver_get_size(&temp_width, &temp_height);
@ -376,10 +372,7 @@ static bool vg_alive(void *data)
&vg->should_resize, &temp_width, &temp_height); &vg->should_resize, &temp_width, &temp_height);
if (temp_width != 0 && temp_height != 0) if (temp_width != 0 && temp_height != 0)
{ video_driver_set_size(&temp_width, &temp_height);
video_driver_set_size_width(temp_width);
video_driver_set_size_height(temp_height);
}
return !quit; return !quit;
} }

View File

@ -65,8 +65,7 @@ static void d3d_resize(void *data, unsigned new_width, unsigned new_height)
RARCH_LOG("[D3D]: Resize %ux%u.\n", new_width, new_height); RARCH_LOG("[D3D]: Resize %ux%u.\n", new_width, new_height);
d3d->video_info.width = new_width; d3d->video_info.width = new_width;
d3d->video_info.height = new_height; d3d->video_info.height = new_height;
video_driver_set_size_width(new_width); video_driver_set_size(&new_width, &new_height);
video_driver_set_size_height(new_height);
d3d_restore(d3d); d3d_restore(d3d);
} }
} }

View File

@ -864,17 +864,14 @@ void video_driver_get_size(unsigned *width, unsigned *height)
*height = video_state.video_height; *height = video_state.video_height;
} }
void video_driver_set_size_width(unsigned width) void video_driver_set_size(unsigned *width, unsigned *height)
{ {
video_state.video_width = width; if (width)
video_state.video_width = *width;
if (height)
video_state.video_height = *height;
} }
void video_driver_set_size_height(unsigned height)
{
video_state.video_height = height;
}
/** /**
* video_monitor_set_refresh_rate: * video_monitor_set_refresh_rate:
* @hz : New refresh rate for monitor. * @hz : New refresh rate for monitor.

View File

@ -402,9 +402,7 @@ bool video_driver_set_viewport(unsigned width, unsigned height,
void video_driver_get_size(unsigned *width, unsigned *height); void video_driver_get_size(unsigned *width, unsigned *height);
void video_driver_set_size_width(unsigned width); void video_driver_set_size(unsigned *width, unsigned *height);
void video_driver_set_size_height(unsigned width);
float video_driver_get_aspect_ratio(void); float video_driver_get_aspect_ratio(void);