mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
libobs: Fix flip calculations in bounding box
This fixes flipping behaviour when positional alignement inside the bounding box is other than centered, bringing it in line with the behaviour when centered, i.e. flip the item in-place in the bounding box.
This commit is contained in:
parent
cb5f65b529
commit
23ca4cf704
|
@ -401,13 +401,19 @@ static void calculate_bounds_data(struct obs_scene_item *item,
|
|||
|
||||
width = (float)(*cx) * scale->x;
|
||||
height = (float)(*cy) * scale->y;
|
||||
width_diff = item->bounds.x - width;
|
||||
height_diff = item->bounds.y - height;
|
||||
|
||||
/* Disregards flip when calculating size diff */
|
||||
width_diff = item->bounds.x - fabsf(width);
|
||||
height_diff = item->bounds.y - fabsf(height);
|
||||
*cx = (uint32_t)item->bounds.x;
|
||||
*cy = (uint32_t)item->bounds.y;
|
||||
|
||||
add_alignment(origin, item->bounds_align, (int)-width_diff,
|
||||
(int)-height_diff);
|
||||
|
||||
/* Makes the item stay in-place in the box if flipped */
|
||||
origin->x += (width < 0.0f) ? width : 0.0f;
|
||||
origin->y += (height < 0.0f) ? height : 0.0f;
|
||||
}
|
||||
|
||||
static inline uint32_t calc_cx(const struct obs_scene_item *item,
|
||||
|
|
Loading…
Reference in a new issue