Go through menu_display_fb_get_ptr pointer
This commit is contained in:
parent
0781311059
commit
263b9e8bcc
|
@ -33,10 +33,10 @@
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
#define RGUI_TERM_START_X (menu->frame_buf.width / 21)
|
#define RGUI_TERM_START_X (frame_buf->width / 21)
|
||||||
#define RGUI_TERM_START_Y (menu->frame_buf.height / 9)
|
#define RGUI_TERM_START_Y (frame_buf->height / 9)
|
||||||
#define RGUI_TERM_WIDTH (((menu->frame_buf.width - RGUI_TERM_START_X - RGUI_TERM_START_X) / (FONT_WIDTH_STRIDE)))
|
#define RGUI_TERM_WIDTH (((frame_buf->width - RGUI_TERM_START_X - RGUI_TERM_START_X) / (FONT_WIDTH_STRIDE)))
|
||||||
#define RGUI_TERM_HEIGHT (((menu->frame_buf.height - RGUI_TERM_START_Y - RGUI_TERM_START_X) / (FONT_HEIGHT_STRIDE)) - 1)
|
#define RGUI_TERM_HEIGHT (((frame_buf->height - RGUI_TERM_START_Y - RGUI_TERM_START_X) / (FONT_HEIGHT_STRIDE)) - 1)
|
||||||
|
|
||||||
#if defined(GEKKO)|| defined(PSP)
|
#if defined(GEKKO)|| defined(PSP)
|
||||||
#define HOVER_COLOR(settings) ((3 << 0) | (10 << 4) | (3 << 8) | (7 << 12))
|
#define HOVER_COLOR(settings) ((3 << 0) | (10 << 4) | (3 << 8) | (7 << 12))
|
||||||
|
@ -132,20 +132,22 @@ static void color_rect(menu_handle_t *menu,
|
||||||
uint16_t color)
|
uint16_t color)
|
||||||
{
|
{
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
|
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||||
|
|
||||||
if (!menu->frame_buf.data)
|
if (!frame_buf || !frame_buf->data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (j = y; j < y + height; j++)
|
for (j = y; j < y + height; j++)
|
||||||
for (i = x; i < x + width; i++)
|
for (i = x; i < x + width; i++)
|
||||||
if (i < menu->frame_buf.width && j < menu->frame_buf.height)
|
if (i < frame_buf->width && j < frame_buf->height)
|
||||||
menu->frame_buf.data[j * (menu->frame_buf.pitch >> 1) + i] = color;
|
frame_buf->data[j * (frame_buf->pitch >> 1) + i] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blit_line(menu_handle_t *menu, int x, int y,
|
static void blit_line(menu_handle_t *menu, int x, int y,
|
||||||
const char *message, uint16_t color)
|
const char *message, uint16_t color)
|
||||||
{
|
{
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
|
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||||
|
|
||||||
while (*message)
|
while (*message)
|
||||||
{
|
{
|
||||||
|
@ -161,8 +163,8 @@ static void blit_line(menu_handle_t *menu, int x, int y,
|
||||||
if (!col)
|
if (!col)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
menu->frame_buf.data[(y + j) *
|
frame_buf->data[(y + j) *
|
||||||
(menu->frame_buf.pitch >> 1) + (x + i)] = color;
|
(frame_buf->pitch >> 1) + (x + i)] = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,13 +222,14 @@ static void rgui_render_background(void)
|
||||||
uint16_t *src = NULL;
|
uint16_t *src = NULL;
|
||||||
uint16_t *dst = NULL;
|
uint16_t *dst = NULL;
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pitch_in_pixels = menu->frame_buf.pitch >> 1;
|
pitch_in_pixels = frame_buf->pitch >> 1;
|
||||||
size = menu->frame_buf.pitch * 4;
|
size = frame_buf->pitch * 4;
|
||||||
src = menu->frame_buf.data + pitch_in_pixels * menu->frame_buf.height;
|
src = frame_buf->data + pitch_in_pixels * frame_buf->height;
|
||||||
dst = menu->frame_buf.data;
|
dst = frame_buf->data;
|
||||||
|
|
||||||
while (dst < src)
|
while (dst < src)
|
||||||
{
|
{
|
||||||
|
@ -234,14 +237,14 @@ static void rgui_render_background(void)
|
||||||
dst += pitch_in_pixels * 4;
|
dst += pitch_in_pixels * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
fill_rect(&menu->frame_buf, 5, 5, menu->frame_buf.width - 10, 5, green_filler);
|
fill_rect(frame_buf, 5, 5, frame_buf->width - 10, 5, green_filler);
|
||||||
fill_rect(&menu->frame_buf, 5, menu->frame_buf.height - 10,
|
fill_rect(frame_buf, 5, frame_buf->height - 10,
|
||||||
menu->frame_buf.width - 10, 5,
|
frame_buf->width - 10, 5,
|
||||||
green_filler);
|
green_filler);
|
||||||
|
|
||||||
fill_rect(&menu->frame_buf, 5, 5, 5, menu->frame_buf.height - 10, green_filler);
|
fill_rect(frame_buf, 5, 5, 5, frame_buf->height - 10, green_filler);
|
||||||
fill_rect(&menu->frame_buf, menu->frame_buf.width - 10, 5, 5,
|
fill_rect(frame_buf, frame_buf->width - 10, 5, 5,
|
||||||
menu->frame_buf.height - 10,
|
frame_buf->height - 10,
|
||||||
green_filler);
|
green_filler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +256,7 @@ static void rgui_render_messagebox(const char *message)
|
||||||
uint16_t color;
|
uint16_t color;
|
||||||
struct string_list *list = NULL;
|
struct string_list *list = NULL;
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
|
@ -339,6 +343,7 @@ static void rgui_render(void)
|
||||||
char title_msg[64] = {0};
|
char title_msg[64] = {0};
|
||||||
char timedate[PATH_MAX_LENGTH] = {0};
|
char timedate[PATH_MAX_LENGTH] = {0};
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||||
runloop_t *runloop = rarch_main_get_ptr();
|
runloop_t *runloop = rarch_main_get_ptr();
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
|
@ -571,6 +576,7 @@ static void rgui_free(void *data)
|
||||||
static void rgui_set_texture(void)
|
static void rgui_set_texture(void)
|
||||||
{
|
{
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return;
|
return;
|
||||||
|
@ -578,8 +584,11 @@ static void rgui_set_texture(void)
|
||||||
menu_display_fb_unset_dirty();
|
menu_display_fb_unset_dirty();
|
||||||
|
|
||||||
video_driver_set_texture_frame(
|
video_driver_set_texture_frame(
|
||||||
menu->frame_buf.data, false,
|
frame_buf->data,
|
||||||
menu->frame_buf.width, menu->frame_buf.height, 1.0f);
|
false,
|
||||||
|
frame_buf->width,
|
||||||
|
frame_buf->height,
|
||||||
|
1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rgui_navigation_clear(bool pending_push)
|
static void rgui_navigation_clear(bool pending_push)
|
||||||
|
@ -594,11 +603,14 @@ static void rgui_navigation_clear(bool pending_push)
|
||||||
|
|
||||||
static void rgui_navigation_set(bool scroll)
|
static void rgui_navigation_set(bool scroll)
|
||||||
{
|
{
|
||||||
|
size_t end;
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return;
|
return;
|
||||||
size_t end = menu_entries_get_end();
|
|
||||||
|
end = menu_entries_get_end();
|
||||||
|
|
||||||
if (!scroll)
|
if (!scroll)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -24,32 +24,35 @@
|
||||||
#include "../gfx/video_context_driver.h"
|
#include "../gfx/video_context_driver.h"
|
||||||
#include "menu_list.h"
|
#include "menu_list.h"
|
||||||
|
|
||||||
bool menu_display_fb_in_use(void)
|
menu_framebuf_t *menu_display_fb_get_ptr(void)
|
||||||
{
|
{
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
if (!menu)
|
if (!menu)
|
||||||
|
return NULL;
|
||||||
|
return &menu->frame_buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool menu_display_fb_in_use(menu_framebuf_t *frame_buf)
|
||||||
|
{
|
||||||
|
if (!frame_buf)
|
||||||
return false;
|
return false;
|
||||||
return menu->frame_buf.data != NULL;
|
return (frame_buf->data != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_display_fb_set_dirty(void)
|
void menu_display_fb_set_dirty(void)
|
||||||
{
|
{
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||||
if (!menu)
|
if (!menu_display_fb_in_use(frame_buf))
|
||||||
return;
|
return;
|
||||||
if (!menu_display_fb_in_use())
|
frame_buf->dirty = true;
|
||||||
return;
|
|
||||||
menu->framebuf.dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_display_fb_unset_dirty(void)
|
void menu_display_fb_unset_dirty(void)
|
||||||
{
|
{
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||||
if (!menu)
|
if (!menu_display_fb_in_use(frame_buf))
|
||||||
return;
|
return;
|
||||||
if (!menu_display_fb_in_use())
|
frame_buf->dirty = false;
|
||||||
return;
|
|
||||||
menu->framebuf.dirty = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,9 +86,13 @@ void menu_display_fb(void)
|
||||||
bool menu_display_update_pending(void)
|
bool menu_display_update_pending(void)
|
||||||
{
|
{
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||||
|
|
||||||
if (menu)
|
if (menu)
|
||||||
{
|
{
|
||||||
if (menu->animation_is_active || menu->label.is_updated || menu->framebuf.dirty)
|
if (menu->animation_is_active || menu->label.is_updated)
|
||||||
|
return true;
|
||||||
|
if (frame_buf && frame_buf->dirty)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -25,9 +25,9 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void menu_display_fb(void);
|
menu_framebuf_t *menu_display_fb_get_ptr(void);
|
||||||
|
|
||||||
bool menu_display_fb_in_use(void);
|
void menu_display_fb(void);
|
||||||
|
|
||||||
void menu_display_fb_set_dirty(void);
|
void menu_display_fb_set_dirty(void);
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ typedef struct menu_framebuf
|
||||||
unsigned width;
|
unsigned width;
|
||||||
unsigned height;
|
unsigned height;
|
||||||
size_t pitch;
|
size_t pitch;
|
||||||
|
bool dirty;
|
||||||
} menu_framebuf_t;
|
} menu_framebuf_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -140,7 +141,6 @@ typedef struct
|
||||||
|
|
||||||
menu_framebuf_t frame_buf;
|
menu_framebuf_t frame_buf;
|
||||||
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
void *buf;
|
void *buf;
|
||||||
|
@ -210,11 +210,6 @@ typedef struct
|
||||||
bool is_updated;
|
bool is_updated;
|
||||||
} label;
|
} label;
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
bool dirty;
|
|
||||||
} framebuf;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool active;
|
bool active;
|
||||||
|
|
Loading…
Reference in New Issue