Update code style
Limit source code to 80 chars, and declare functions return type and modifiers on a separate line. This allows to avoid very long lines, and all function names are aligned. (We do this on VLC, and I like it.)
This commit is contained in:
@@ -4,13 +4,15 @@
|
||||
|
||||
#include "log.h"
|
||||
|
||||
void fps_counter_init(struct fps_counter *counter) {
|
||||
void
|
||||
fps_counter_init(struct fps_counter *counter) {
|
||||
counter->started = SDL_FALSE;
|
||||
// no need to initialize the other fields, they are meaningful only when
|
||||
// started is true
|
||||
}
|
||||
|
||||
void fps_counter_start(struct fps_counter *counter) {
|
||||
void
|
||||
fps_counter_start(struct fps_counter *counter) {
|
||||
counter->started = SDL_TRUE;
|
||||
counter->slice_start = SDL_GetTicks();
|
||||
counter->nr_rendered = 0;
|
||||
@@ -19,14 +21,17 @@ void fps_counter_start(struct fps_counter *counter) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void fps_counter_stop(struct fps_counter *counter) {
|
||||
void
|
||||
fps_counter_stop(struct fps_counter *counter) {
|
||||
counter->started = SDL_FALSE;
|
||||
}
|
||||
|
||||
static void display_fps(struct fps_counter *counter) {
|
||||
static void
|
||||
display_fps(struct fps_counter *counter) {
|
||||
#ifdef SKIP_FRAMES
|
||||
if (counter->nr_skipped) {
|
||||
LOGI("%d fps (+%d frames skipped)", counter->nr_rendered, counter->nr_skipped);
|
||||
LOGI("%d fps (+%d frames skipped)", counter->nr_rendered,
|
||||
counter->nr_skipped);
|
||||
} else {
|
||||
#endif
|
||||
LOGI("%d fps", counter->nr_rendered);
|
||||
@@ -35,7 +40,8 @@ static void display_fps(struct fps_counter *counter) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static void check_expired(struct fps_counter *counter) {
|
||||
static void
|
||||
check_expired(struct fps_counter *counter) {
|
||||
Uint32 now = SDL_GetTicks();
|
||||
if (now - counter->slice_start >= 1000) {
|
||||
display_fps(counter);
|
||||
@@ -49,13 +55,15 @@ static void check_expired(struct fps_counter *counter) {
|
||||
}
|
||||
}
|
||||
|
||||
void fps_counter_add_rendered_frame(struct fps_counter *counter) {
|
||||
void
|
||||
fps_counter_add_rendered_frame(struct fps_counter *counter) {
|
||||
check_expired(counter);
|
||||
++counter->nr_rendered;
|
||||
}
|
||||
|
||||
#ifdef SKIP_FRAMES
|
||||
void fps_counter_add_skipped_frame(struct fps_counter *counter) {
|
||||
void
|
||||
fps_counter_add_skipped_frame(struct fps_counter *counter) {
|
||||
check_expired(counter);
|
||||
++counter->nr_skipped;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user