Add apply_state_changes.
This commit is contained in:
parent
63d946c69f
commit
0b67cd7e84
1
driver.h
1
driver.h
|
@ -234,6 +234,7 @@ typedef struct video_poke_interface
|
|||
void (*set_filtering)(void *data, unsigned index, bool smooth);
|
||||
void (*set_fbo_state)(void *data, unsigned state);
|
||||
void (*set_aspect_ratio)(void *data, unsigned aspectratio_index);
|
||||
void (*apply_state_changes)(void *data);
|
||||
|
||||
// Set to NULL if RGUI texture is not supposed to be rendered.
|
||||
void (*set_rgui_texture)(void *data, const void *frame);
|
||||
|
|
7
gfx/gl.c
7
gfx/gl.c
|
@ -2294,11 +2294,18 @@ static void gl_set_rgui_texture(void *data, const void *frame)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void gl_apply_state_changes(void *data)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
gl->should_resize = true;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t gl_poke_interface = {
|
||||
gl_set_blend,
|
||||
gl_set_filtering,
|
||||
gl_set_fbo_state,
|
||||
gl_set_aspect_ratio,
|
||||
gl_apply_state_changes,
|
||||
#ifdef HAVE_RGUI
|
||||
gl_set_rgui_texture,
|
||||
#endif
|
||||
|
|
|
@ -71,6 +71,7 @@ typedef struct thread_video
|
|||
#ifdef HAVE_RGUI
|
||||
const void *rgui_texture;
|
||||
#endif
|
||||
bool apply_state_changes;
|
||||
|
||||
bool alive;
|
||||
bool focus;
|
||||
|
@ -300,6 +301,11 @@ static void thread_loop(void *data)
|
|||
#ifdef HAVE_RGUI
|
||||
thr->poke->set_rgui_texture(thr->driver_data, thr->rgui_texture);
|
||||
#endif
|
||||
if (thr->apply_state_changes)
|
||||
{
|
||||
thr->poke->apply_state_changes(thr->driver_data);
|
||||
thr->apply_state_changes = false;
|
||||
}
|
||||
|
||||
bool ret = thr->driver->frame(thr->driver_data,
|
||||
thr->frame.buffer, thr->frame.width, thr->frame.height,
|
||||
|
@ -638,11 +644,20 @@ static void thread_set_rgui_texture(void *data, const void *frame)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void thread_apply_state_changes(void *data)
|
||||
{
|
||||
thread_video_t *thr = (thread_video_t*)data;
|
||||
slock_lock(thr->frame.lock);
|
||||
thr->apply_state_changes = true;
|
||||
slock_unlock(thr->frame.lock);
|
||||
}
|
||||
|
||||
static const video_poke_interface_t thread_poke = {
|
||||
thread_set_blend,
|
||||
thread_set_filtering,
|
||||
thread_set_fbo_state,
|
||||
thread_set_aspect_ratio,
|
||||
thread_apply_state_changes,
|
||||
#ifdef HAVE_RGUI
|
||||
thread_set_rgui_texture,
|
||||
#endif
|
||||
|
|
|
@ -1031,11 +1031,18 @@ static void gx_set_rgui_texture(void *data, const void *frame)
|
|||
gx->menu_data = (uint32_t*)frame;
|
||||
}
|
||||
|
||||
static void gx_apply_state_changes(void *data)
|
||||
{
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
gx->should_resize = true;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t gx_poke_interface = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gx_set_aspect_ratio,
|
||||
gx_apply_state_changes,
|
||||
gx_set_rgui_texture,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue