Skip to content

Commit

Permalink
Fix crop to bounds on first frame of transition
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro committed Jun 11, 2024
1 parent 22f2ca4 commit 940c547
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion buildspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@
}
},
"name": "move-transition",
"version": "3.0.0"
"version": "3.0.1"
}
20 changes: 13 additions & 7 deletions move-transition.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 940c547

Please sign in to comment.