gfx_common.c - make gfx_get_fps into the main public function -

and remove the two public wrapper functions
This commit is contained in:
twinaphex 2012-12-15 07:03:33 +01:00
parent 7685009f56
commit 799a9c35fb
15 changed files with 20 additions and 31 deletions

View File

@ -269,7 +269,7 @@ static void gfx_ctx_update_window_title(bool reset)
char buf[128];
if (gfx_window_title(buf, sizeof(buf)))
if (gfx_get_fps(buf, sizeof(buf), false))
RARCH_LOG("%s.\n", buf);
#endif
}

View File

@ -244,7 +244,7 @@ static void gfx_ctx_update_window_title(bool reset)
gfx_window_title_reset();
char buf[128];
if (gfx_window_title(buf, sizeof(buf)))
if (gfx_get_fps(buf, sizeof(buf), false))
XStoreName(g_dpy, g_win, buf);
}

View File

@ -94,7 +94,7 @@ static void gfx_ctx_update_window_title(bool reset)
gfx_window_title_reset();
char buf[128];
if (gfx_window_title(buf, sizeof(buf)))
if (gfx_get_fps(buf, sizeof(buf), false))
gfx_ctx_wm_set_caption(buf);
}

View File

@ -115,7 +115,7 @@ static void gfx_ctx_update_window_title(bool reset)
char buf[128];
if (gfx_window_title(buf, sizeof(buf)))
if (gfx_get_fps(buf, sizeof(buf), false))
RARCH_LOG("%s.\n", buf);
}

View File

@ -181,7 +181,7 @@ static void gfx_ctx_update_window_title(bool reset)
gfx_window_title_reset();
char buf[128];
if (gfx_window_title(buf, sizeof(buf)))
if (gfx_get_fps(buf, sizeof(buf), false))
SetWindowText(g_hwnd, buf);
}

View File

@ -138,7 +138,7 @@ static void gfx_ctx_update_window_title(bool reset)
gfx_window_title_reset();
char buf[128];
if (gfx_window_title(buf, sizeof(buf)))
if (gfx_get_fps(buf, sizeof(buf), false))
XStoreName(g_dpy, g_win, buf);
}

View File

@ -412,7 +412,7 @@ D3DVideo::D3DVideo(const video_info_t *info) :
gfx_window_title_reset();
char buffer[128];
gfx_window_title(buffer, sizeof(buffer));
gfx_get_fps(buffer, sizeof(buffer), false);
std::string title = buffer;
title += " || Direct3D9";
@ -1112,7 +1112,7 @@ void D3DVideo::deinit_font()
void D3DVideo::update_title()
{
char buffer[128];
if (gfx_window_title(buffer, sizeof(buffer)))
if (gfx_get_fps(buffer, sizeof(buffer), false))
{
std::string title = buffer;
title += " || Direct3D9";

View File

@ -282,7 +282,7 @@ static bool setup_video(ext_t *ext, const video_info_t *video, const input_drive
char title_buf[128];
gfx_window_title_reset();
gfx_window_title(title_buf, sizeof(title_buf));
gfx_get_fps(title_buf, sizeof(title_buf), false);
rarch_video_info_t info = {0};
info.width = video->width;

View File

@ -79,7 +79,7 @@ static float tv_to_fps(const struct timeval *tv, const struct timeval *new_tv, i
return frames/time;
}
static bool gfx_get_fps(char *buf, size_t size, bool always_write)
bool gfx_get_fps(char *buf, size_t size, bool always_write)
{
static struct timeval tv;
static float last_fps;
@ -124,16 +124,6 @@ void gfx_window_title_reset(void)
g_extern.frame_count = 0;
}
bool gfx_window_title(char *buf, size_t size)
{
return gfx_get_fps(buf, size, false);
}
void gfx_fps_title(char *buf, size_t size)
{
gfx_get_fps(buf, size, true);
}
#if defined(_WIN32) && !defined(_XBOX)
#include <windows.h>
#include "../dynamic.h"

View File

@ -27,13 +27,11 @@ extern "C" {
#include "../config.h"
#endif
// Returns true if FPS value was updated.
bool gfx_window_title(char *buf, size_t size);
// If always_write is true, will always update FPS value
// If always_write is false, returns true if FPS value was updated.
bool gfx_get_fps(char *buf, size_t size, bool always_write);
void gfx_window_title_reset(void);
// Like gfx_window_title, but always updates FPS value.
void gfx_fps_title(char *buf, size_t size);
#ifdef _WIN32
void gfx_set_dwm(void);
#endif

View File

@ -1172,7 +1172,8 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
if (fps_enable)
{
char fps_txt[128];
gfx_fps_title(fps_txt, sizeof(fps_txt));
gfx_get_fps(fps_txt, sizeof(fps_txt), true);
if (gl->font_ctx)
gl->font_ctx->render_msg_place(gl, g_settings.video.msg_pos_x, 0.56f, 1.04f, WHITE, fps_txt);
}

View File

@ -307,7 +307,7 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width, unsigne
SDL_UnlockSurface(vid->screen);
char buf[128];
if (gfx_window_title(buf, sizeof(buf)))
if (gfx_get_fps(buf, sizeof(buf), false))
SDL_WM_SetCaption(buf, NULL);
SDL_Flip(vid->screen);

View File

@ -407,7 +407,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
XMapWindow(xv->display, xv->window);
if (gfx_window_title(buf, sizeof(buf)))
if (gfx_get_fps(buf, sizeof(buf), false))
XStoreName(xv->display, xv->window, buf);
x11_set_window_attr(xv->display, xv->window);
@ -687,7 +687,7 @@ static bool xv_frame(void *data, const void *frame, unsigned width, unsigned hei
XSync(xv->display, False);
char buf[128];
if (gfx_window_title(buf, sizeof(buf)))
if (gfx_get_fps(buf, sizeof(buf), false))
XStoreName(xv->display, xv->window, buf);
return true;

View File

@ -853,7 +853,7 @@ static bool gx_frame(void *data, const void *frame,
unsigned x = 15;
unsigned y = 15;
gfx_fps_title(fps_txt, sizeof(fps_txt));
gfx_get_fps(fps_txt, sizeof(fps_txt), true);
gx_blit_line(x, y, fps_txt);
y += FONT_HEIGHT * (gx->double_strike ? 1 : 2);
snprintf(mem1_txt, sizeof(mem1_txt), "MEM1: %8d / %8d", SYSMEM1_SIZE - SYS_GetArena1Size(), SYSMEM1_SIZE);

View File

@ -807,7 +807,7 @@ static bool xdk_d3d_frame(void *data, const void *frame,
snprintf(buf, sizeof(buf), "%.2f MB free / %.2f MB total", stat.dwAvailPhys/(1024.0f*1024.0f), stat.dwTotalPhys/(1024.0f*1024.0f));
d3d->font_ctx->render_msg_place(d3d, mem_width, mem_height, 0, 0, buf);
gfx_fps_title(fps_txt, sizeof(fps_txt));
gfx_get_fps(fps_txt, sizeof(fps_txt), true);
d3d->font_ctx->render_msg_place(d3d, mem_width, mem_height + 30, 0, 0, fps_txt);
}