From a4d09fe74201a6c8572691b8dad6791067aa4fca Mon Sep 17 00:00:00 2001 From: fryshorts Date: Tue, 18 Nov 2014 20:32:47 +0100 Subject: [PATCH] linux-xshm: Small change for texture update function. This removes the entering/leaving of the graphics context from this function and requires the calling code to make sure the context is present. --- plugins/linux-capture/xshm-input.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/linux-capture/xshm-input.c b/plugins/linux-capture/xshm-input.c index 5a226d437..a969a05ae 100644 --- a/plugins/linux-capture/xshm-input.c +++ b/plugins/linux-capture/xshm-input.c @@ -56,17 +56,15 @@ struct xshm_data { * Resize the texture * * This will automatically create the texture if it does not exist + * + * @note requires to be called within the obs graphics context */ -static void xshm_resize_texture(struct xshm_data *data) +static inline void xshm_resize_texture(struct xshm_data *data) { - obs_enter_graphics(); - if (data->texture) gs_texture_destroy(data->texture); data->texture = gs_texture_create(data->width, data->height, GS_BGRA, 1, NULL, GS_DYNAMIC); - - obs_leave_graphics(); } /** @@ -138,7 +136,9 @@ static void xshm_update(void *vptr, obs_data_t *settings) return; } + obs_enter_graphics(); xshm_resize_texture(data); + obs_leave_graphics(); xcursor_offset(data->cursor, data->x_org, data->y_org); data->xshm = xshm_attach(data->dpy, data->screen,