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.
This commit is contained in:
parent
643823505c
commit
4d61fa9a4c
@ -390,9 +390,15 @@ static inline bool scale_filter_enabled(const struct obs_scene_item *item)
|
|||||||
return item->scale_filter != OBS_SCALE_DISABLE;
|
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)
|
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)
|
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;
|
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);
|
full_lock(scene);
|
||||||
|
|
||||||
last = scene->first_item;
|
last = scene->first_item;
|
||||||
@ -1787,7 +1799,8 @@ void obs_sceneitem_set_crop(obs_sceneitem_t *item,
|
|||||||
if (crop_equal(crop, &item->crop))
|
if (crop_equal(crop, &item->crop))
|
||||||
return;
|
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();
|
obs_enter_graphics();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user