From eae4d761ba41bcb9049fffd83978c1fc85129cdf Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 25 Sep 2015 21:32:16 +0200 Subject: [PATCH] (Menu) Refactors --- menu/drivers/rgui.c | 22 +++++++++++++++------- menu/drivers/xmb.c | 7 ++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 0bdc59822b..a1f63c4503 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -637,6 +637,8 @@ static void rgui_render(void) static void *rgui_init(void) { + size_t fb_pitch; + unsigned fb_width, fb_height; bool ret = false; menu_framebuf_t *frame_buf = NULL; menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu)); @@ -658,10 +660,16 @@ static void *rgui_init(void) if (!frame_buf->data) goto error; - frame_buf->width = 320; - frame_buf->height = 240; + fb_width = 320; + fb_height = 240; + fb_pitch = fb_width * sizeof(uint16_t); + + menu_display_ctl(MENU_DISPLAY_CTL_SET_WIDTH, &fb_width); + menu_display_ctl(MENU_DISPLAY_CTL_SET_HEIGHT, &fb_height); + menu->display.header_height = FONT_HEIGHT_STRIDE * 2; - frame_buf->pitch = frame_buf->width * sizeof(uint16_t); + + menu_display_ctl(MENU_DISPLAY_CTL_SET_FB_PITCH, &fb_pitch); menu_entries_set_start(0); @@ -670,11 +678,11 @@ static void *rgui_init(void) if (!ret) goto error; - fill_rect(frame_buf->data, frame_buf->pitch, 0, frame_buf->height, - frame_buf->width, 4, gray_filler); + fill_rect(frame_buf->data, fb_pitch, 0, fb_height, + fb_width, 4, gray_filler); - rgui->last_width = frame_buf->width; - rgui->last_height = frame_buf->height; + rgui->last_width = fb_width; + rgui->last_height = fb_height; return menu; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 3b24bf371d..82b29adacf 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1803,7 +1803,6 @@ static void *xmb_init(void) menu_handle_t *menu = NULL; xmb_handle_t *xmb = NULL; const video_driver_t *video_driver = NULL; - menu_framebuf_t *frame_buf = NULL; float scale_factor = 1; gl_t *gl = (gl_t*) video_driver_get_ptr(&video_driver); @@ -1821,8 +1820,6 @@ static void *xmb_init(void) if (!menu) goto error; - frame_buf = menu_display_fb_get_ptr(); - video_driver_get_size(&width, &height); menu->userdata = (xmb_handle_t*)calloc(1, sizeof(xmb_handle_t)); @@ -1871,8 +1868,8 @@ static void *xmb_init(void) * for XMB, we should refactor this dependency * away. */ - frame_buf->width = width; - frame_buf->height = height; + menu_display_ctl(MENU_DISPLAY_CTL_SET_WIDTH, &width); + menu_display_ctl(MENU_DISPLAY_CTL_SET_HEIGHT, &height); xmb_init_horizontal_list(menu, xmb); xmb_font(menu);