Add apply_state_changes.

This commit is contained in:
Themaister 2013-03-10 19:39:37 +01:00
parent 63d946c69f
commit 0b67cd7e84
4 changed files with 30 additions and 0 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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,
};