libobs: UI: Fix rotated line scale

The line drawing functions previously assumed the upper-left 3x3 for
box_transform only held scale. The matrix can also hold rotation, so
pass in scale separately.

Fixes https://obsproject.com/mantis/view.php?id=1442
This commit is contained in:
James Park
2019-04-19 06:35:42 -07:00
parent ebb8d6bc28
commit e01fcae133
4 changed files with 38 additions and 23 deletions

View File

@@ -395,6 +395,8 @@ static void update_item_transform(struct obs_scene_item *item, bool update_tex)
scale.y = (float)height * item->scale.y;
}
item->box_scale = scale;
add_alignment(&base_origin, item->align, (int)scale.x, (int)scale.y);
matrix4_identity(&item->box_transform);
@@ -1260,6 +1262,7 @@ static inline void duplicate_item_data(struct obs_scene_item *dst,
dst->output_scale = src->output_scale;
dst->scale_filter = src->scale_filter;
dst->box_transform = src->box_transform;
dst->box_scale = src->box_scale;
dst->draw_transform = src->draw_transform;
dst->bounds_type = src->bounds_type;
dst->bounds_align = src->bounds_align;
@@ -2047,6 +2050,13 @@ void obs_sceneitem_get_box_transform(const obs_sceneitem_t *item,
matrix4_copy(transform, &item->box_transform);
}
void obs_sceneitem_get_box_scale(const obs_sceneitem_t *item,
struct vec2 *scale)
{
if (item)
*scale = item->box_scale;
}
bool obs_sceneitem_visible(const obs_sceneitem_t *item)
{
return item ? item->user_visible : false;