From 0bccda75fa831d0304e1cc1c08ebb41f5fecaa32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Fri, 1 May 2015 09:35:27 -0300 Subject: [PATCH] (GLUI) Cleanups --- menu/drivers/glui.c | 35 +++++++---------------------------- menu/menu_display.h | 3 +-- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 8a3bc7ac50..a2785136a4 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -203,17 +203,11 @@ static void glui_render_messagebox(const char *message) uint32_t normal_color; int x, y; struct string_list *list = NULL; - glui_handle_t *glui = NULL; menu_handle_t *menu = menu_driver_get_ptr(); settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); - if (!menu) - return; - - glui = (glui_handle_t*)menu->userdata; - - if (!glui) + if (!menu || !menu->userdata) return; list = (struct string_list*)string_split(message, "\n"); @@ -248,14 +242,11 @@ static void glui_render(void) settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); - if (!menu) + if (!menu || !menu->userdata) return; glui = (glui_handle_t*)menu->userdata; - if (!glui) - return; - menu_animation_update(menu->animation, menu->dt / IDEAL_DT); menu->frame_buf.width = global->video_data.width; @@ -378,7 +369,7 @@ static void glui_frame(void) global_t *global = global_get_ptr(); const struct font_renderer *font_driver = NULL; - if (!menu) + if (!menu || !menu->userdata) return; gl = (gl_t*)video_driver_get_ptr(NULL); @@ -388,9 +379,6 @@ static void glui_frame(void) glui = (glui_handle_t*)menu->userdata; - if (!glui) - return; - if (menu->need_refresh && runloop->is_menu && !menu->msg_force) @@ -596,13 +584,10 @@ static bool glui_load_wallpaper(void *data) glui_handle_t *glui = NULL; menu_handle_t *menu = menu_driver_get_ptr(); - if (!menu) + if (!menu || !menu->userdata) return false; glui = (glui_handle_t*)menu->userdata; - - if (!glui) - return false; glui_context_bg_destroy(glui); @@ -619,14 +604,10 @@ static float glui_get_scroll(void) menu_handle_t *menu = menu_driver_get_ptr(); global_t *global = global_get_ptr(); - if (!menu) + if (!menu || !menu->userdata) return 0; glui = (glui_handle_t*)menu->userdata; - - if (!glui) - return 0; - half = (global->video_data.height / glui->line_height) / 2; if (menu->navigation.selection_ptr < half) @@ -682,17 +663,15 @@ static void glui_populate_entries(const char *path, static void glui_context_reset(void) { - gl_t *gl = (gl_t*)video_driver_get_ptr(NULL); glui_handle_t *glui = NULL; - driver_t *driver = driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr(); settings_t *settings = config_get_ptr(); const char *font_path = NULL; - if (!menu || !menu->userdata || !settings || !gl) + if (!menu || !menu->userdata || !settings) return; - glui = (glui_handle_t*)menu->userdata; + glui = (glui_handle_t*)menu->userdata; font_path = settings->video.font_path; if (!menu_display_init_main_font(menu, font_path, menu->font.size)) diff --git a/menu/menu_display.h b/menu/menu_display.h index a736c37151..1fc8a7f6fd 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -44,10 +44,9 @@ bool menu_display_font_bind_block(menu_handle_t *menu, bool menu_display_font_flush_block(menu_handle_t *menu, const struct font_renderer *font_driver); -/** Shortcut to initialize menu->font.buf */ +/** Shortcuts to handle menu->font.buf */ bool menu_display_init_main_font(menu_handle_t *menu, const char *font_path, float font_size); - void menu_display_free_main_font(menu_handle_t *menu); void menu_display_set_viewport(menu_handle_t *menu);