Remove screen static initializer
Most of the fields are initialized dynamically.
This commit is contained in:
parent
cb9c42bdcb
commit
955da3b578
2 changed files with 7 additions and 34 deletions
|
@ -215,10 +215,14 @@ on_frame_skipped(struct video_buffer *vb, void *userdata) {
|
||||||
void
|
void
|
||||||
screen_init(struct screen *screen, struct video_buffer *vb,
|
screen_init(struct screen *screen, struct video_buffer *vb,
|
||||||
struct fps_counter *fps_counter) {
|
struct fps_counter *fps_counter) {
|
||||||
*screen = (struct screen) SCREEN_INITIALIZER;
|
|
||||||
screen->vb = vb;
|
screen->vb = vb;
|
||||||
screen->fps_counter = fps_counter;
|
screen->fps_counter = fps_counter;
|
||||||
|
|
||||||
|
screen->resize_pending = false;
|
||||||
|
screen->has_frame = false;
|
||||||
|
screen->fullscreen = false;
|
||||||
|
screen->maximized = false;
|
||||||
|
|
||||||
static const struct video_buffer_callbacks cbs = {
|
static const struct video_buffer_callbacks cbs = {
|
||||||
.on_frame_available = on_frame_available,
|
.on_frame_available = on_frame_available,
|
||||||
.on_frame_skipped = on_frame_skipped,
|
.on_frame_skipped = on_frame_skipped,
|
||||||
|
@ -311,6 +315,8 @@ screen_init_rendering(struct screen *screen, const char *window_title,
|
||||||
const char *renderer_name = r ? NULL : renderer_info.name;
|
const char *renderer_name = r ? NULL : renderer_info.name;
|
||||||
LOGI("Renderer: %s", renderer_name ? renderer_name : "(unknown)");
|
LOGI("Renderer: %s", renderer_name ? renderer_name : "(unknown)");
|
||||||
|
|
||||||
|
screen->mipmaps = false;
|
||||||
|
|
||||||
// starts with "opengl"
|
// starts with "opengl"
|
||||||
bool use_opengl = renderer_name && !strncmp(renderer_name, "opengl", 6);
|
bool use_opengl = renderer_name && !strncmp(renderer_name, "opengl", 6);
|
||||||
if (use_opengl) {
|
if (use_opengl) {
|
||||||
|
|
|
@ -38,39 +38,6 @@ struct screen {
|
||||||
bool mipmaps;
|
bool mipmaps;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SCREEN_INITIALIZER { \
|
|
||||||
.vb = NULL, \
|
|
||||||
.fps_counter = NULL, \
|
|
||||||
.window = NULL, \
|
|
||||||
.renderer = NULL, \
|
|
||||||
.texture = NULL, \
|
|
||||||
.gl = {0}, \
|
|
||||||
.frame_size = { \
|
|
||||||
.width = 0, \
|
|
||||||
.height = 0, \
|
|
||||||
}, \
|
|
||||||
.content_size = { \
|
|
||||||
.width = 0, \
|
|
||||||
.height = 0, \
|
|
||||||
}, \
|
|
||||||
.resize_pending = false, \
|
|
||||||
.windowed_content_size = { \
|
|
||||||
.width = 0, \
|
|
||||||
.height = 0, \
|
|
||||||
}, \
|
|
||||||
.rotation = 0, \
|
|
||||||
.rect = { \
|
|
||||||
.x = 0, \
|
|
||||||
.y = 0, \
|
|
||||||
.w = 0, \
|
|
||||||
.h = 0, \
|
|
||||||
}, \
|
|
||||||
.has_frame = false, \
|
|
||||||
.fullscreen = false, \
|
|
||||||
.maximized = false, \
|
|
||||||
.mipmaps = false, \
|
|
||||||
}
|
|
||||||
|
|
||||||
// initialize default values
|
// initialize default values
|
||||||
void
|
void
|
||||||
screen_init(struct screen *screen, struct video_buffer *vb,
|
screen_init(struct screen *screen, struct video_buffer *vb,
|
||||||
|
|
Loading…
Reference in a new issue