From 4d61fa9a4cc682488e4b6e4b0591d4e2393054c5 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Fri, 1 Jul 2016 15:21:12 -0700 Subject: [PATCH] libobs: Use item texture if scene item is scene Allows rendering scenes as scene items without off-screen sub-source of the scene popping out on the sides. --- libobs/obs-scene.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libobs/obs-scene.c b/libobs/obs-scene.c index 553d86356..16b256531 100644 --- a/libobs/obs-scene.c +++ b/libobs/obs-scene.c @@ -390,9 +390,15 @@ static inline bool scale_filter_enabled(const struct obs_scene_item *item) return item->scale_filter != OBS_SCALE_DISABLE; } +static inline bool item_is_scene(const struct obs_scene_item *item) +{ + return item->source && item->source->info.type == OBS_SOURCE_TYPE_SCENE; +} + static inline bool item_texture_enabled(const struct obs_scene_item *item) { - return crop_enabled(&item->crop) || scale_filter_enabled(item); + return crop_enabled(&item->crop) || scale_filter_enabled(item) || + item_is_scene(item); } static void render_item_texture(struct obs_scene_item *item) @@ -1280,6 +1286,12 @@ obs_sceneitem_t *obs_scene_add(obs_scene_t *scene, obs_source_t *source) item->visible = true; } + if (item_texture_enabled(item)) { + obs_enter_graphics(); + item->item_render = gs_texrender_create(GS_RGBA, GS_ZS_NONE); + obs_leave_graphics(); + } + full_lock(scene); last = scene->first_item; @@ -1787,7 +1799,8 @@ void obs_sceneitem_set_crop(obs_sceneitem_t *item, if (crop_equal(crop, &item->crop)) return; - item_tex_now_enabled = crop_enabled(crop) || scale_filter_enabled(item); + item_tex_now_enabled = crop_enabled(crop) || + scale_filter_enabled(item) || item_is_scene(item); obs_enter_graphics();