static inline void dc_capture_release_dc(struct dc_capture *capture) { if (capture->compatibility) { gs_texture_set_image(capture->texture, capture->bits, capture->width*4, false); } else { gs_texture_release_dc(capture->texture); } }
void gs_image_file_update_texture(gs_image_file_t *image) { if (!image->is_animated_gif || !image->loaded) return; if (image->animation_frame_cache[image->cur_frame]) { gs_texture_set_image(image->texture, image->animation_frame_cache[image->cur_frame], image->gif.width * 4, false); } }
/** * Prepare the capture data */ static void xshm_video_tick(void *vptr, float seconds) { UNUSED_PARAMETER(seconds); XSHM_DATA(vptr); if (!data->xshm) return; obs_enter_graphics(); XShmGetImage(data->dpy, XRootWindowOfScreen(data->screen), data->xshm->image, data->x_org, data->y_org, AllPlanes); gs_texture_set_image(data->texture, (void *) data->xshm->image->data, data->width * 4, false); xcursor_tick(data->cursor); obs_leave_graphics(); }
/* * Create the cursor texture, either by updating if the new cursor has the same * size or by creating a new texture if the size is different */ static void xcursor_create(xcursor_t *data, XFixesCursorImage *xc) { uint32_t *pixels = xcursor_pixels(xc); if (data->tex && data->last_height == xc->width && data->last_width == xc->height) { gs_texture_set_image(data->tex, (const uint8_t *) pixels, xc->width * sizeof(uint32_t), False); } else { if (data->tex) gs_texture_destroy(data->tex); data->tex = gs_texture_create(xc->width, xc->height, GS_BGRA, 1, (const uint8_t **) &pixels, GS_DYNAMIC); } bfree(pixels); data->last_serial = xc->cursor_serial; data->last_width = xc->width; data->last_height = xc->height; }
/** * Prepare the capture data */ static void xshm_video_tick(void *vptr, float seconds) { UNUSED_PARAMETER(seconds); XSHM_DATA(vptr); if (!data->texture) return; if (!obs_source_showing(data->source)) return; xcb_shm_get_image_cookie_t img_c; xcb_shm_get_image_reply_t *img_r; xcb_xfixes_get_cursor_image_cookie_t cur_c; xcb_xfixes_get_cursor_image_reply_t *cur_r; img_c = xcb_shm_get_image_unchecked(data->xcb, data->xcb_screen->root, data->x_org, data->y_org, data->width, data->height, ~0, XCB_IMAGE_FORMAT_Z_PIXMAP, data->xshm->seg, 0); cur_c = xcb_xfixes_get_cursor_image_unchecked(data->xcb); img_r = xcb_shm_get_image_reply(data->xcb, img_c, NULL); cur_r = xcb_xfixes_get_cursor_image_reply(data->xcb, cur_c, NULL); if (!img_r) goto exit; obs_enter_graphics(); gs_texture_set_image(data->texture, (void *) data->xshm->data, data->width * 4, false); xcb_xcursor_update(data->cursor, cur_r); obs_leave_graphics(); exit: free(img_r); free(cur_r); }
/* * Create the cursor texture, either by updating if the new cursor has the same * size or by creating a new texture if the size is different */ static void xcb_xcursor_create(xcb_xcursor_t *data, xcb_xfixes_get_cursor_image_reply_t *xc) { uint32_t *pixels = xcb_xfixes_get_cursor_image_cursor_image(xc); if (!pixels) return; if (data->tex && data->last_height == xc->width && data->last_width == xc->height) { gs_texture_set_image(data->tex, (const uint8_t *) pixels, xc->width * sizeof(uint32_t), false); } else { if (data->tex) gs_texture_destroy(data->tex); data->tex = gs_texture_create(xc->width, xc->height, GS_BGRA, 1, (const uint8_t **) &pixels, GS_DYNAMIC); } data->last_serial = xc->cursor_serial; data->last_width = xc->width; data->last_height = xc->height; }