From 940c547ed26843d59ea2b17797ec6d58a033cea1 Mon Sep 17 00:00:00 2001 From: Exeldro Date: Tue, 11 Jun 2024 15:10:56 +0200 Subject: [PATCH] Fix crop to bounds on first frame of transition --- CMakeLists.txt | 2 +- buildspec.json | 2 +- move-transition.c | 20 +++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6baeae..38b7d07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ else() cmake_minimum_required(VERSION 3.18) endif() -project(move-transition VERSION 3.0.0) +project(move-transition VERSION 3.0.1) set(PROJECT_FULL_NAME "Move Transition") # Set new UUIDs when you start to create a new plugin. diff --git a/buildspec.json b/buildspec.json index 49ae40a..853d1bc 100644 --- a/buildspec.json +++ b/buildspec.json @@ -79,5 +79,5 @@ } }, "name": "move-transition", - "version": "3.0.0" + "version": "3.0.1" } diff --git a/move-transition.c b/move-transition.c index dd3941b..c58ad10 100644 --- a/move-transition.c +++ b/move-transition.c @@ -484,14 +484,21 @@ static inline bool default_blending_enabled(struct obs_scene_item *item) return obs_sceneitem_get_blending_mode(item) == OBS_BLEND_NORMAL; } -static inline bool item_texture_enabled(struct obs_scene_item *item, struct obs_sceneitem_crop *bounds_crop) +static inline bool item_texture_enabled(struct obs_scene_item *item) { if (!item) return false; struct obs_sceneitem_crop crop; obs_sceneitem_get_crop(item, &crop); - return crop_enabled(&crop) || crop_enabled(bounds_crop) || scale_filter_enabled(item) || !default_blending_enabled(item) || - (item_is_scene(item) && !obs_sceneitem_is_group(item)); + if (crop_enabled(&crop)) + return true; + if (item_is_scene(item) && !obs_sceneitem_is_group(item)) + return true; + if (scale_filter_enabled(item) || !default_blending_enabled(item)) + return true; + if (crop_to_bounds(item, obs_sceneitem_get_bounds_type(item))) + return true; + return false; } void pos_add_center(struct vec2 *pos, uint32_t alignment, uint32_t cx, uint32_t cy) @@ -1456,12 +1463,11 @@ bool render2_item(struct move_info *move, struct move_item *item) struct vec2 output_scale = scale; - if (item->item_render && !item_texture_enabled(item->item_a, &item->bounds_crop_a) && - !item_texture_enabled(item->item_b, &item->bounds_crop_b)) { + if (item->item_render && !item_texture_enabled(item->item_a) && !item_texture_enabled(item->item_b)) { gs_texrender_destroy(item->item_render); item->item_render = NULL; - } else if (!item->item_render && ((item->item_a && item_texture_enabled(item->item_a, &item->bounds_crop_a)) || - (item->item_b && item_texture_enabled(item->item_b, &item->bounds_crop_b)))) { + } else if (!item->item_render && + ((item->item_a && item_texture_enabled(item->item_a)) || (item->item_b && item_texture_enabled(item->item_b)))) { item->item_render = gs_texrender_create(GS_RGBA, GS_ZS_NONE); } else if (item->item_render) { gs_texrender_reset(item->item_render);