Style nit party.

This commit is contained in:
Themaister 2012-05-27 23:14:46 +02:00
parent 1d05161723
commit 72310b6661
6 changed files with 94 additions and 88 deletions

View File

@ -256,7 +256,7 @@ void gfx_ctx_set_fbo(bool enable)
void gfx_ctx_get_available_resolutions (void) void gfx_ctx_get_available_resolutions (void)
{ {
bool defaultresolution; bool defaultresolution;
uint32_t i, resolution_count; uint32_t resolution_count;
uint16_t num_videomodes; uint16_t num_videomodes;
if (g_console.check_available_resolutions) if (g_console.check_available_resolutions)
@ -268,20 +268,22 @@ void gfx_ctx_get_available_resolutions (void)
CELL_VIDEO_OUT_RESOLUTION_480, CELL_VIDEO_OUT_RESOLUTION_576, CELL_VIDEO_OUT_RESOLUTION_480, CELL_VIDEO_OUT_RESOLUTION_576,
CELL_VIDEO_OUT_RESOLUTION_960x1080, CELL_VIDEO_OUT_RESOLUTION_720, CELL_VIDEO_OUT_RESOLUTION_960x1080, CELL_VIDEO_OUT_RESOLUTION_720,
CELL_VIDEO_OUT_RESOLUTION_1280x1080, CELL_VIDEO_OUT_RESOLUTION_1440x1080, CELL_VIDEO_OUT_RESOLUTION_1280x1080, CELL_VIDEO_OUT_RESOLUTION_1440x1080,
CELL_VIDEO_OUT_RESOLUTION_1600x1080, CELL_VIDEO_OUT_RESOLUTION_1080}; CELL_VIDEO_OUT_RESOLUTION_1600x1080, CELL_VIDEO_OUT_RESOLUTION_1080
};
num_videomodes = sizeof(videomode) / sizeof(uint32_t); num_videomodes = sizeof(videomode) / sizeof(uint32_t);
resolution_count = 0; resolution_count = 0;
for (i = 0; i < num_videomodes; i++) for (unsigned i = 0; i < num_videomodes; i++)
{
if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i], CELL_VIDEO_OUT_ASPECT_AUTO, 0)) if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i], CELL_VIDEO_OUT_ASPECT_AUTO, 0))
resolution_count++; resolution_count++;
}
g_console.supported_resolutions = (uint32_t*)malloc(resolution_count * sizeof(uint32_t)); g_console.supported_resolutions = malloc(resolution_count * sizeof(uint32_t));
g_console.supported_resolutions_count = 0; g_console.supported_resolutions_count = 0;
for (i = 0; i < num_videomodes; i++) for (unsigned i = 0; i < num_videomodes; i++)
{ {
if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i], CELL_VIDEO_OUT_ASPECT_AUTO, 0)) if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i], CELL_VIDEO_OUT_ASPECT_AUTO, 0))
{ {
@ -352,7 +354,7 @@ const char * ps3_get_resolution_label(uint32_t resolution)
} }
} }
void gfx_ctx_set_projection(gl_t *gl, ortho_t *ortho, bool allow_rotate) void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate)
{ {
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
@ -406,3 +408,4 @@ void gfx_ctx_set_overscan(void)
gl->should_resize = true; gl->should_resize = true;
} }

View File

@ -398,7 +398,7 @@ void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
} }
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
void gfx_ctx_set_projection(gl_t *gl, ortho_t *ortho, bool allow_rotate) void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate)
{ {
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
@ -406,7 +406,7 @@ void gfx_ctx_set_projection(gl_t *gl, ortho_t *ortho, bool allow_rotate)
if (allow_rotate) if (allow_rotate)
glRotatef(gl->rotation, 0, 0, 1); glRotatef(gl->rotation, 0, 0, 1);
glOrtho(0, 1, 0, 1, -1, 1); glOrtho(ortho->left, ortho->right, ortho->bottom, ortho->top, ortho->near, ortho->far);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
} }

View File

@ -227,7 +227,6 @@ extern const GLfloat white_color[];
void gl_render_msg_post(gl_t *gl) void gl_render_msg_post(gl_t *gl)
{ {
ortho_t ortho = {0}; //dummy - no overscan on PC
#ifdef HAVE_FREETYPE #ifdef HAVE_FREETYPE
// Go back to old rendering path. // Go back to old rendering path.
glTexCoordPointer(2, GL_FLOAT, 0, gl->tex_coords); glTexCoordPointer(2, GL_FLOAT, 0, gl->tex_coords);
@ -236,6 +235,8 @@ void gl_render_msg_post(gl_t *gl)
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
glDisable(GL_BLEND); glDisable(GL_BLEND);
struct gl_ortho ortho = {0, 1, 0, 1, -1, 1};
gl_set_projection(gl, &ortho, true); gl_set_projection(gl, &ortho, true);
#else #else
(void)gl; (void)gl;

View File

@ -73,7 +73,7 @@ void gfx_ctx_get_available_resolutions(void);
#endif #endif
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
void gfx_ctx_set_projection(gl_t *gl, ortho_t *ortho, bool allow_rotate); void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate);
#endif #endif
#endif #endif

View File

@ -423,7 +423,7 @@ static void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
//////////// ////////////
void gl_set_projection(gl_t *gl, ortho_t *ortho, bool allow_rotate) void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate)
{ {
#ifdef RARCH_CONSOLE #ifdef RARCH_CONSOLE
if (g_console.overscan_enable) if (g_console.overscan_enable)
@ -441,7 +441,7 @@ void gl_set_projection(gl_t *gl, ortho_t *ortho, bool allow_rotate)
void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate) void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate)
{ {
unsigned vp_x_temp, vp_y_temp, vp_width_temp, vp_height_temp; unsigned vp_x_temp, vp_y_temp, vp_width_temp, vp_height_temp;
ortho_t ortho; struct gl_ortho ortho = {0};
vp_x_temp = 0; vp_x_temp = 0;
vp_y_temp = 0; vp_y_temp = 0;
@ -472,6 +472,7 @@ void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full,
} }
else else
#endif #endif
{
if (fabs(device_aspect - desired_aspect) < 0.0001) if (fabs(device_aspect - desired_aspect) < 0.0001)
{ {
// If the aspect ratios of screen and desired aspect ratio are sufficiently equal (floating point stuff), // If the aspect ratios of screen and desired aspect ratio are sufficiently equal (floating point stuff),
@ -492,6 +493,7 @@ void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full,
height = (unsigned)(2.0 * height * delta); height = (unsigned)(2.0 * height * delta);
} }
} }
}
glViewport(vp_x_temp, vp_y_temp, vp_width_temp, vp_height_temp); glViewport(vp_x_temp, vp_y_temp, vp_width_temp, vp_height_temp);
@ -512,7 +514,7 @@ void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full,
static void gl_set_rotation(void *data, unsigned rotation) static void gl_set_rotation(void *data, unsigned rotation)
{ {
ortho_t ortho; struct gl_ortho ortho = {0};
ortho.left = 0; ortho.left = 0;
ortho.right = 1; ortho.right = 1;
@ -521,7 +523,7 @@ static void gl_set_rotation(void *data, unsigned rotation)
ortho.near = -1; ortho.near = -1;
ortho.far = 1; ortho.far = 1;
gl_t * gl = driver.video_data; gl_t *gl = (gl_t*)driver.video_data;
gl->rotation = 90 * rotation; gl->rotation = 90 * rotation;
gl_set_projection(gl, &ortho, true); gl_set_projection(gl, &ortho, true);
} }

View File

@ -107,15 +107,15 @@ struct gl_fbo_scale
bool valid; bool valid;
}; };
typedef struct struct gl_ortho
{ {
float left; GLfloat left;
float right; GLfloat right;
float bottom; GLfloat bottom;
float top; GLfloat top;
float near; GLfloat near;
float far; GLfloat far;
} ortho_t; };
struct gl_tex_info struct gl_tex_info
{ {
@ -222,7 +222,7 @@ extern PFNGLACTIVETEXTUREPROC pglActiveTexture;
#endif #endif
void gl_shader_use(unsigned index); void gl_shader_use(unsigned index);
void gl_set_projection(gl_t *gl, ortho_t *ortho, bool allow_rotate); void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate);
void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate); void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate);
#endif #endif