(Menu) Cleanups

This commit is contained in:
twinaphex 2015-09-25 21:07:12 +02:00
parent f4951300b7
commit 1329b4f265
4 changed files with 21 additions and 8 deletions

View File

@ -397,13 +397,11 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
if (frame_buf)
{
frame_buf->height = gx_mode.efbHeight / (gx->double_strike ? 1 : 2);
frame_buf->height &= ~3;
frame_buf->height = (gx_mode.efbHeight / (gx->double_strike ? 1 : 2)) & ~3;
if (frame_buf->height > 240)
frame_buf->height = 240;
frame_buf->width = gx_mode.fbWidth / (gx_mode.fbWidth < 400 ? 1 : 2);
frame_buf->width &= ~3;
frame_buf->width = (gx_mode.fbWidth / (gx_mode.fbWidth < 400 ? 1 : 2)) & ~3;
if (frame_buf->width > 400)
frame_buf->width = 400;
frame_buf->pitch = frame_buf->width * 2;
@ -1101,11 +1099,14 @@ static bool gx_frame(void *data, const void *frame,
if (frame_buf)
{
convert_texture16(gx->menu_data, menu_tex.data,
convert_texture16(
gx->menu_data,
menu_tex.data,
frame_buf->width,
frame_buf->height,
frame_buf->pitch);
DCFlushRange(menu_tex.data,
DCFlushRange(
menu_tex.data,
frame_buf->width *
frame_buf->pitch);
}

View File

@ -713,12 +713,15 @@ static void rgui_set_texture(void)
{
unsigned fb_width, fb_height;
uint16_t *fb_data = NULL;
bool fb_dirty = false;
menu_handle_t *menu = menu_driver_get_ptr();
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
if (!menu)
return;
if (!frame_buf->dirty)
menu_display_ctl(MENU_DISPLAY_CTL_GET_FRAMEBUFFER_DIRTY_FLAG, &fb_dirty);
if (!fb_dirty)
return;
menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width);

View File

@ -284,6 +284,14 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
video_driver_set_viewport(width,
height, false, true);
return true;
case MENU_DISPLAY_CTL_GET_FRAMEBUFFER_DIRTY_FLAG:
{
bool *ptr = (bool*)data;
if (!ptr)
return false;
*ptr = frame_buf->dirty;
}
return true;
case MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG:
if (frame_buf && frame_buf->data)
frame_buf->dirty = true;

View File

@ -33,6 +33,7 @@ enum menu_display_ctl_state
{
MENU_DISPLAY_CTL_SET_VIEWPORT = 0,
MENU_DISPLAY_CTL_UNSET_VIEWPORT,
MENU_DISPLAY_CTL_GET_FRAMEBUFFER_DIRTY_FLAG,
MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG,
MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG,
MENU_DISPLAY_CTL_GET_DPI,