mirror of
https://github.com/libretro/RetroArch
synced 2025-01-27 03:35:22 +00:00
Create GFX_CTL_TRANSLATE_ASPECT
This commit is contained in:
parent
f94e9c532e
commit
ce41c5bbca
@ -647,12 +647,18 @@ static void d3d_calculate_rect(void *data,
|
|||||||
bool force_full,
|
bool force_full,
|
||||||
bool allow_rotate)
|
bool allow_rotate)
|
||||||
{
|
{
|
||||||
|
gfx_ctx_aspect_t aspect_data;
|
||||||
float device_aspect = (float)*width / *height;
|
float device_aspect = (float)*width / *height;
|
||||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
video_driver_get_size(width, height);
|
video_driver_get_size(width, height);
|
||||||
gfx_ctx_translate_aspect(&device_aspect, *width, *height);
|
|
||||||
|
aspect_data.aspect = &device_aspect;
|
||||||
|
aspect_data.width = *width;
|
||||||
|
aspect_data.height = *height;
|
||||||
|
|
||||||
|
gfx_ctx_ctl(GFX_CTL_TRANSLATE_ASPECT, &aspect_data);
|
||||||
|
|
||||||
*x = 0;
|
*x = 0;
|
||||||
*y = 0;
|
*y = 0;
|
||||||
|
@ -848,6 +848,7 @@ static void gl_set_projection(gl_t *gl, struct gfx_ortho *ortho, bool allow_rota
|
|||||||
static void gl_set_viewport(void *data, unsigned viewport_width,
|
static void gl_set_viewport(void *data, unsigned viewport_width,
|
||||||
unsigned viewport_height, bool force_full, bool allow_rotate)
|
unsigned viewport_height, bool force_full, bool allow_rotate)
|
||||||
{
|
{
|
||||||
|
gfx_ctx_aspect_t aspect_data;
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
float device_aspect = (float)viewport_width / viewport_height;
|
float device_aspect = (float)viewport_width / viewport_height;
|
||||||
@ -857,8 +858,11 @@ static void gl_set_viewport(void *data, unsigned viewport_width,
|
|||||||
|
|
||||||
video_driver_get_size(&width, &height);
|
video_driver_get_size(&width, &height);
|
||||||
|
|
||||||
gfx_ctx_translate_aspect(&device_aspect,
|
aspect_data.aspect = &device_aspect;
|
||||||
viewport_width, viewport_height);
|
aspect_data.width = viewport_width;
|
||||||
|
aspect_data.height = viewport_height;
|
||||||
|
|
||||||
|
gfx_ctx_ctl(GFX_CTL_TRANSLATE_ASPECT, &aspect_data);
|
||||||
|
|
||||||
if (settings->video.scale_integer && !force_full)
|
if (settings->video.scale_integer && !force_full)
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,7 @@ static INLINE bool vg_query_extension(const char *ext)
|
|||||||
|
|
||||||
static void *vg_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
static void *vg_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||||
{
|
{
|
||||||
|
gfx_ctx_aspect_t aspect_data;
|
||||||
unsigned interval;
|
unsigned interval;
|
||||||
unsigned temp_width = 0, temp_height = 0;
|
unsigned temp_width = 0, temp_height = 0;
|
||||||
VGfloat clearColor[4] = {0, 0, 0, 1};
|
VGfloat clearColor[4] = {0, 0, 0, 1};
|
||||||
@ -142,7 +143,11 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
|
|||||||
|
|
||||||
vg->mScreenAspect = (float)temp_width / temp_height;
|
vg->mScreenAspect = (float)temp_width / temp_height;
|
||||||
|
|
||||||
gfx_ctx_translate_aspect(&vg->mScreenAspect, temp_width, temp_height);
|
aspect_data.aspect = &vg->mScreenAspect;
|
||||||
|
aspect_data.width = temp_width;
|
||||||
|
aspect_data.height = temp_height;
|
||||||
|
|
||||||
|
gfx_ctx_ctl(GFX_CTL_TRANSLATE_ASPECT, &aspect_data);
|
||||||
|
|
||||||
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
|
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@ enum gfx_ctx_ctl_state
|
|||||||
GFX_CTL_FIND_PREV_DRIVER,
|
GFX_CTL_FIND_PREV_DRIVER,
|
||||||
GFX_CTL_GET_VIDEO_OUTPUT_SIZE,
|
GFX_CTL_GET_VIDEO_OUTPUT_SIZE,
|
||||||
GFX_CTL_SWAP_INTERVAL,
|
GFX_CTL_SWAP_INTERVAL,
|
||||||
GFX_CTL_PROC_ADDRESS_GET
|
GFX_CTL_PROC_ADDRESS_GET,
|
||||||
|
GFX_CTL_TRANSLATE_ASPECT
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*gfx_ctx_proc_t)(void);
|
typedef void (*gfx_ctx_proc_t)(void);
|
||||||
@ -191,8 +192,8 @@ typedef struct gfx_ctx_metrics
|
|||||||
typedef struct gfx_ctx_aspect
|
typedef struct gfx_ctx_aspect
|
||||||
{
|
{
|
||||||
float *aspect;
|
float *aspect;
|
||||||
unsigned *width;
|
unsigned width;
|
||||||
unsigned *height;
|
unsigned height;
|
||||||
} gfx_ctx_aspect_t;
|
} gfx_ctx_aspect_t;
|
||||||
|
|
||||||
typedef struct gfx_ctx_image
|
typedef struct gfx_ctx_image
|
||||||
@ -255,9 +256,6 @@ const gfx_ctx_driver_t *gfx_ctx_init_first(void *data, const char *ident,
|
|||||||
|
|
||||||
bool gfx_ctx_get_metrics(enum display_metric_types type, float *value);
|
bool gfx_ctx_get_metrics(enum display_metric_types type, float *value);
|
||||||
|
|
||||||
void gfx_ctx_translate_aspect(float *aspect,
|
|
||||||
unsigned width, unsigned height);
|
|
||||||
|
|
||||||
bool gfx_ctx_set_video_mode(unsigned width, unsigned height,
|
bool gfx_ctx_set_video_mode(unsigned width, unsigned height,
|
||||||
bool fullscreen);
|
bool fullscreen);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user