Rename and move rarch_viewport

This commit is contained in:
twinaphex 2015-02-14 05:52:05 +01:00
parent b777f019bf
commit 64446ef497
28 changed files with 99 additions and 77 deletions

View File

@ -31,6 +31,7 @@
#include "core_options.h"
#include "core_info.h"
#include <retro_miscellaneous.h>
#include "gfx/video_viewport.h"
#include "playlist.h"
@ -83,16 +84,6 @@ enum sound_mode_enums
SOUND_MODE_LAST
};
typedef struct rarch_viewport
{
int x;
int y;
unsigned width;
unsigned height;
unsigned full_width;
unsigned full_height;
} rarch_viewport_t;
struct defaults
{
char menu_config_dir[PATH_MAX_LENGTH];
@ -705,7 +696,7 @@ struct global
struct
{
rarch_viewport_t custom_vp;
video_viewport_t custom_vp;
} viewports;
unsigned gamma_correction;

View File

@ -349,7 +349,7 @@ static void d3d_calculate_rect(d3d_video_t *d3d,
{
if (g_settings.video.scale_integer)
{
struct rarch_viewport vp = {0};
struct video_viewport vp = {0};
video_viewport_get_scaled_integer(&vp, width, height, desired_aspect, keep);
d3d_set_viewport(d3d, vp.x, vp.y, vp.width, vp.height);
}
@ -359,8 +359,10 @@ static void d3d_calculate_rect(d3d_video_t *d3d,
{
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const rarch_viewport_t &custom =
const video_viewport_t &custom =
g_extern.console.screen.viewports.custom_vp;
if (custom)
d3d_set_viewport(d3d, custom.x, custom.y,
custom.width, custom.height);
}
@ -639,7 +641,7 @@ static bool d3d_construct(d3d_video_t *d3d,
return true;
}
static void d3d_viewport_info(void *data, struct rarch_viewport *vp)
static void d3d_viewport_info(void *data, struct video_viewport *vp)
{
d3d_video_t *d3d = (d3d_video_t*)data;

View File

@ -1505,7 +1505,7 @@ static void exynos_gfx_set_rotation(void *data, unsigned rotation)
vid->menu_rotation = rotation;
}
static void exynos_gfx_viewport_info(void *data, struct rarch_viewport *vp)
static void exynos_gfx_viewport_info(void *data, struct video_viewport *vp)
{
struct exynos_video *vid = (struct exynos_video*)data;

View File

@ -784,9 +784,7 @@ void gl_set_viewport(gl_t *gl, unsigned width,
#if defined(HAVE_MENU)
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct rarch_viewport *custom =
(const struct rarch_viewport*)
&g_extern.console.screen.viewports.custom_vp;
const struct video_viewport *custom = &g_extern.console.screen.viewports.custom_vp;
/* GL has bottom-left origin viewport. */
x = custom->x;
@ -2624,10 +2622,11 @@ static bool gl_set_shader(void *data,
#endif
}
static void gl_viewport_info(void *data, struct rarch_viewport *vp)
static void gl_viewport_info(void *data, struct video_viewport *vp)
{
unsigned top_y, top_dist;
gl_t *gl = (gl_t*)data;
*vp = gl->vp;
vp->full_width = gl->win_width;
vp->full_height = gl->win_height;

View File

@ -1135,7 +1135,7 @@ static void gx_apply_state_changes(void *data)
gx->should_resize = true;
}
static void gx_viewport_info(void *data, struct rarch_viewport *vp)
static void gx_viewport_info(void *data, struct video_viewport *vp)
{
gx_video_t *gx = (gx_video_t*)data;
*vp = gx->vp;

View File

@ -18,6 +18,8 @@
#ifndef _GX_VIDEO_H__
#define _GX_VIDEO_H__
#include "../video_viewport.h"
struct gx_overlay_data
{
GXTexObj tex;
@ -34,7 +36,7 @@ typedef struct gx_video
bool rgb32;
uint32_t *menu_data; /* FIXME: Should be const uint16_t*. */
bool menu_texture_enable;
rarch_viewport_t vp;
video_viewport_t vp;
unsigned scale;
#ifdef HAVE_OVERLAY
struct gx_overlay_data *overlay;

View File

@ -16,6 +16,7 @@
#include "../../general.h"
#include "../../driver.h"
#include "../video_viewport.h"
static void *null_gfx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
@ -94,7 +95,7 @@ static void null_gfx_set_rotation(void *data,
}
static void null_gfx_viewport_info(void *data,
struct rarch_viewport *vp)
struct video_viewport *vp)
{
(void)data;
(void)vp;

View File

@ -999,7 +999,7 @@ static bool omap_gfx_focus(void *data)
return true; /* fb device always has focus */
}
static void omap_gfx_viewport_info(void *data, struct rarch_viewport *vp)
static void omap_gfx_viewport_info(void *data, struct video_viewport *vp)
{
omap_video_t *vid = (omap_video_t*)data;

View File

@ -102,7 +102,7 @@ typedef struct psp1_video
psp1_menu_frame_t menu;
rarch_viewport_t vp;
video_viewport_t vp;
unsigned rotation;
bool vblank_not_reached;
@ -715,14 +715,17 @@ static void psp_update_viewport(psp1_video_t* psp)
#if defined(HAVE_MENU)
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct rarch_viewport *custom =
const struct video_viewport *custom =
&g_extern.console.screen.viewports.custom_vp;
if (custom)
{
x = custom->x;
y = custom->y;
width = custom->width;
height = custom->height;
}
}
else
#endif
{
@ -828,7 +831,7 @@ static void psp_apply_state_changes(void *data)
psp->should_resize = true;
}
static void psp_viewport_info(void *data, struct rarch_viewport *vp)
static void psp_viewport_info(void *data, struct video_viewport *vp)
{
psp1_video_t *psp = (psp1_video_t*)data;

View File

@ -69,7 +69,7 @@ typedef struct _sdl2_video
uint8_t font_g;
uint8_t font_b;
struct rarch_viewport vp;
struct video_viewport vp;
video_info_t video;
@ -274,13 +274,16 @@ static void sdl_refresh_viewport(sdl2_video_t *vid)
vid->video.force_aspect);
else if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct rarch_viewport *custom = &g_extern.console.screen.viewports.custom_vp;
const struct video_viewport *custom = &g_extern.console.screen.viewports.custom_vp;
if (custom)
{
vid->vp.x = custom->x;
vid->vp.y = custom->y;
vid->vp.width = custom->width;
vid->vp.height = custom->height;
}
}
else if (vid->video.force_aspect)
{
float delta;
@ -592,7 +595,7 @@ static void sdl2_gfx_set_rotation(void *data, unsigned rotation)
vid->rotation = 270 * rotation;
}
static void sdl2_gfx_viewport_info(void *data, struct rarch_viewport *vp)
static void sdl2_gfx_viewport_info(void *data, struct video_viewport *vp)
{
sdl2_video_t *vid = (sdl2_video_t*)data;
*vp = vid->vp;

View File

@ -424,7 +424,7 @@ static bool sdl_gfx_has_windowed(void *data)
return true;
}
static void sdl_gfx_viewport_info(void *data, struct rarch_viewport *vp)
static void sdl_gfx_viewport_info(void *data, struct video_viewport *vp)
{
sdl_video_t *vid = (sdl_video_t*)data;
vp->x = vp->y = 0;

View File

@ -28,6 +28,7 @@
#include "../../performance.h"
#include "../font_renderer_driver.h"
#include "../../content.h"
#include "../gfx/video_viewport.h"
typedef struct
{
@ -453,7 +454,7 @@ static void vg_set_rotation(void *data, unsigned rotation)
}
static void vg_viewport_info(void *data,
struct rarch_viewport *vp)
struct video_viewport *vp)
{
(void)data;
(void)vp;

View File

@ -25,6 +25,8 @@
#include "../../driver.h"
#include "../../general.h"
#Include "../video_viewport.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -292,7 +294,7 @@ static void xenon360_gfx_set_rotation(void *data, unsigned rotation)
(void)rotation;
}
static void xenon360_gfx_viewport_info(void *data, struct rarch_viewport *vp)
static void xenon360_gfx_viewport_info(void *data, struct video_viewport *vp)
{
(void)data;
(void)vp;

View File

@ -59,7 +59,7 @@ typedef struct xv
unsigned width;
unsigned height;
bool keep_aspect;
struct rarch_viewport vp;
struct video_viewport vp;
uint8_t *ytable;
uint8_t *utable;
@ -350,7 +350,7 @@ static bool adaptor_set_format(xv_t *xv, Display *dpy,
return false;
}
static void calc_out_rect(bool keep_aspect, struct rarch_viewport *vp,
static void calc_out_rect(bool keep_aspect, struct video_viewport *vp,
unsigned vp_width, unsigned vp_height)
{
vp->full_width = vp_width;
@ -878,7 +878,7 @@ static void xv_free(void *data)
free(xv);
}
static void xv_viewport_info(void *data, struct rarch_viewport *vp)
static void xv_viewport_info(void *data, struct video_viewport *vp)
{
xv_t *xv = (xv_t*)data;
*vp = xv->vp;

View File

@ -305,7 +305,7 @@ typedef struct gl
unsigned win_width;
unsigned win_height;
struct rarch_viewport vp;
struct video_viewport vp;
unsigned vp_out_width;
unsigned vp_out_height;
unsigned last_width[MAX_TEXTURES];

View File

@ -19,7 +19,6 @@
#include "video_driver.h"
#include "video_thread_wrapper.h"
#include "video_pixel_converter.h"
#include "video_viewport.h"
#include "video_monitor.h"
#include "../general.h"
#include "../retroarch.h"
@ -386,7 +385,7 @@ void uninit_video_input(void)
void init_video(void)
{
unsigned max_dim, scale, width, height;
rarch_viewport_t *custom_vp;
video_viewport_t *custom_vp = NULL;
const input_driver_t *tmp = NULL;
const struct retro_game_geometry *geom = NULL;
video_info_t video = {0};
@ -409,7 +408,7 @@ void init_video(void)
video_viewport_set_config();
/* Update CUSTOM viewport. */
custom_vp = (rarch_viewport_t*)&g_extern.console.screen.viewports.custom_vp;
custom_vp = &g_extern.console.screen.viewports.custom_vp;
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
float default_aspect = aspectratio_lut[ASPECT_RATIO_CORE].value;

View File

@ -24,6 +24,7 @@
#include <gfx/scaler/scaler.h>
#include "video_filter.h"
#include "video_shader_parse.h"
#include "video_viewport.h"
#include "../libretro.h"
#include "../input/input_driver.h"
@ -33,8 +34,6 @@
extern "C" {
#endif
struct rarch_viewport;
typedef struct video_info
{
unsigned width;
@ -159,7 +158,7 @@ typedef struct video_driver
const char *ident;
void (*set_rotation)(void *data, unsigned rotation);
void (*viewport_info)(void *data, struct rarch_viewport *vp);
void (*viewport_info)(void *data, struct video_viewport *vp);
/* Reads out in BGR byte order (24bpp). */
bool (*read_viewport)(void *data, uint8_t *buffer);

View File

@ -15,6 +15,7 @@
*/
#include "video_thread_wrapper.h"
#include "video_viewport.h"
#include "../performance.h"
#include <file/dir_list.h>
#include <stdlib.h>
@ -135,7 +136,7 @@ static void thread_loop(void *data)
case CMD_READ_VIEWPORT:
{
struct rarch_viewport vp = {0};
struct video_viewport vp = {0};
thr->driver->viewport_info(thr->driver_data, &vp);
@ -306,7 +307,7 @@ static void thread_loop(void *data)
bool alive = false;
bool focus = false;
bool has_windowed = true;
struct rarch_viewport vp = {0};
struct video_viewport vp = {0};
slock_lock(thr->frame.lock);
@ -591,7 +592,7 @@ static void thread_set_rotation(void *data, unsigned rotation)
*
* This means this value might not be correct, so viewport
* reads are not supported for now. */
static void thread_viewport_info(void *data, struct rarch_viewport *vp)
static void thread_viewport_info(void *data, struct video_viewport *vp)
{
thread_video_t *thr = (thread_video_t*)data;

View File

@ -168,8 +168,8 @@ typedef struct thread_video
} cmd_data;
struct rarch_viewport vp;
struct rarch_viewport read_vp; /* Last viewport reported to caller. */
struct video_viewport vp;
struct video_viewport read_vp; /* Last viewport reported to caller. */
struct
{

View File

@ -153,19 +153,21 @@ void video_viewport_get_scaled_integer(void *data,
float aspect_ratio, bool keep_aspect)
{
int padding_x = 0, padding_y = 0;
struct rarch_viewport *vp = (struct rarch_viewport*)data;
struct video_viewport *vp = (struct video_viewport*)data;
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct rarch_viewport *custom =
(const struct rarch_viewport*)
const struct video_viewport *custom =
&g_extern.console.screen.viewports.custom_vp;
if (custom)
{
padding_x = width - custom->width;
padding_y = height - custom->height;
width = custom->width;
height = custom->height;
}
}
else
{
unsigned base_width;

View File

@ -20,12 +20,21 @@
#include <stddef.h>
#include <stdint.h>
#include <boolean.h>
#include "../general.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct video_viewport
{
int x;
int y;
unsigned width;
unsigned height;
unsigned full_width;
unsigned full_height;
} video_viewport_t;
enum aspect_ratio
{
ASPECT_RATIO_4_3 = 0,

View File

@ -19,6 +19,8 @@
#include "../../driver.h"
#include "../../gfx/video_viewport.h"
#include <boolean.h>
#include "../../general.h"
#include <stdint.h>
@ -281,7 +283,7 @@ static void x_input_poll_mouse(x11_input_t *x11)
/* Somewhat hacky, but seem to do the job. */
if (x11->grab_mouse && driver.video->focus(driver.video_data))
{
struct rarch_viewport vp = {0};
struct video_viewport vp = {0};
if (driver.video && driver.video->viewport_info)
driver.video->viewport_info(driver.video_data, &vp);

View File

@ -25,6 +25,8 @@
#include "../config.h"
#endif
#include "../gfx/video_viewport.h"
static const char *bind_user_prefix[MAX_USERS] = {
"input_player1",
"input_player2",
@ -130,7 +132,7 @@ bool input_translate_coord_viewport(int mouse_x, int mouse_y,
int16_t *res_screen_y)
{
int scaled_screen_x, scaled_screen_y, scaled_x, scaled_y;
struct rarch_viewport vp = {0};
struct video_viewport vp = {0};
bool have_viewport_info = driver.video && driver.video->viewport_info;
if (!have_viewport_info)

View File

@ -43,6 +43,8 @@
#include "../input/input_autodetect.h"
#include "../input/input_remapping.h"
#include "../gfx/video_viewport.h"
#ifdef GEKKO
enum
{
@ -1547,15 +1549,13 @@ static int action_ok_set_path(const char *path,
static int action_ok_custom_viewport(const char *path,
const char *label, unsigned type, size_t idx)
{
rarch_viewport_t *custom = NULL;
/* Start with something sane. */
video_viewport_t *custom = &g_extern.console.screen.viewports.custom_vp;
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return -1;
/* Start with something sane. */
custom = (rarch_viewport_t*)
&g_extern.console.screen.viewports.custom_vp;
menu_list_push_stack(
menu->menu_list,
@ -4127,8 +4127,7 @@ static int action_iterate_menu_viewport(const char *label, unsigned action)
struct retro_game_geometry *geom = NULL;
const char *base_msg = NULL;
unsigned type = 0;
rarch_viewport_t *custom = (rarch_viewport_t*)
&g_extern.console.screen.viewports.custom_vp;
video_viewport_t *custom = &g_extern.console.screen.viewports.custom_vp;
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return -1;
@ -4220,7 +4219,7 @@ static int action_iterate_menu_viewport(const char *label, unsigned action)
case MENU_ACTION_START:
if (!g_settings.video.scale_integer)
{
rarch_viewport_t vp;
video_viewport_t vp;
if (driver.video_data && driver.video &&
driver.video->viewport_info)

View File

@ -22,6 +22,7 @@
#include "../general.h"
#include "../retroarch.h"
#include "../intl/intl.h"
#include "../gfx/video_viewport.h"
#ifdef HAVE_CONFIG_H
#include "../config.h"
@ -101,7 +102,7 @@ void recording_dump_frame(const void *data, unsigned width,
if (g_extern.record_gpu_buffer)
{
struct rarch_viewport vp = {0};
struct video_viewport vp = {0};
if (driver.video && driver.video->viewport_info)
driver.video->viewport_info(driver.video_data, &vp);
@ -220,7 +221,7 @@ bool recording_init(void)
if (g_settings.video.gpu_record && driver.video->read_viewport)
{
struct rarch_viewport vp = {0};
struct video_viewport vp = {0};
if (driver.video && driver.video->viewport_info)
driver.video->viewport_info(driver.video_data, &vp);

View File

@ -18,6 +18,7 @@
#define __RETROARCH_H
#include <boolean.h>
#include "core_info.h"
#ifdef __cplusplus
extern "C" {

View File

@ -28,6 +28,7 @@
#include "retroarch.h"
#include "retroarch_logger.h"
#include "screenshot.h"
#include "gfx/video_viewport.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -175,7 +176,7 @@ static bool take_screenshot_viewport(void)
const char *screenshot_dir = NULL;
uint8_t *buffer = NULL;
bool retval = false;
struct rarch_viewport vp = {0};
struct video_viewport vp = {0};
if (driver.video && driver.video->viewport_info)
driver.video->viewport_info(driver.video_data, &vp);

View File

@ -23,7 +23,9 @@
#include "input/input_common.h"
#include "input/input_keymaps.h"
#include "input/input_remapping.h"
#include "gfx/video_viewport.h"
#include "settings.h"
#include "general.h"
#ifdef HAVE_CONFIG_H
#include "config.h"