compositor: let view_compute_bbox() take a box32_t
There are two call sites, one is already having a pixman_box32_t it needs to call view_compute_bbox() with. The other call site will have a box32_t when view clipping gets implemented. Change view_compute_bbox() to take a pixman_box32_t as the input argument, and convert call sites. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
+13
-14
@@ -1078,22 +1078,21 @@ weston_view_assign_output(struct weston_view *ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
view_compute_bbox(struct weston_view *view, int32_t sx, int32_t sy,
|
view_compute_bbox(struct weston_view *view, const pixman_box32_t *inbox,
|
||||||
int32_t width, int32_t height,
|
|
||||||
pixman_region32_t *bbox)
|
pixman_region32_t *bbox)
|
||||||
{
|
{
|
||||||
float min_x = HUGE_VALF, min_y = HUGE_VALF;
|
float min_x = HUGE_VALF, min_y = HUGE_VALF;
|
||||||
float max_x = -HUGE_VALF, max_y = -HUGE_VALF;
|
float max_x = -HUGE_VALF, max_y = -HUGE_VALF;
|
||||||
int32_t s[4][2] = {
|
int32_t s[4][2] = {
|
||||||
{ sx, sy },
|
{ inbox->x1, inbox->y1 },
|
||||||
{ sx, sy + height },
|
{ inbox->x1, inbox->y2 },
|
||||||
{ sx + width, sy },
|
{ inbox->x2, inbox->y1 },
|
||||||
{ sx + width, sy + height }
|
{ inbox->x2, inbox->y2 },
|
||||||
};
|
};
|
||||||
float int_x, int_y;
|
float int_x, int_y;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (width == 0 || height == 0) {
|
if (inbox->x1 == inbox->x2 || inbox->y1 == inbox->y2) {
|
||||||
/* avoid rounding empty bbox to 1x1 */
|
/* avoid rounding empty bbox to 1x1 */
|
||||||
pixman_region32_init(bbox);
|
pixman_region32_init(bbox);
|
||||||
return;
|
return;
|
||||||
@@ -1160,6 +1159,7 @@ weston_view_update_transform_enable(struct weston_view *view)
|
|||||||
struct weston_matrix *matrix = &view->transform.matrix;
|
struct weston_matrix *matrix = &view->transform.matrix;
|
||||||
struct weston_matrix *inverse = &view->transform.inverse;
|
struct weston_matrix *inverse = &view->transform.inverse;
|
||||||
struct weston_transform *tform;
|
struct weston_transform *tform;
|
||||||
|
pixman_box32_t surfbox;
|
||||||
|
|
||||||
view->transform.enabled = 1;
|
view->transform.enabled = 1;
|
||||||
|
|
||||||
@@ -1182,9 +1182,11 @@ weston_view_update_transform_enable(struct weston_view *view)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
view_compute_bbox(view, 0, 0,
|
surfbox.x1 = 0;
|
||||||
view->surface->width, view->surface->height,
|
surfbox.y1 = 0;
|
||||||
&view->transform.boundingbox);
|
surfbox.x2 = view->surface->width;
|
||||||
|
surfbox.y2 = view->surface->height;
|
||||||
|
view_compute_bbox(view, &surfbox, &view->transform.boundingbox);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1829,10 +1831,7 @@ view_accumulate_damage(struct weston_view *view,
|
|||||||
pixman_box32_t *extents;
|
pixman_box32_t *extents;
|
||||||
|
|
||||||
extents = pixman_region32_extents(&view->surface->damage);
|
extents = pixman_region32_extents(&view->surface->damage);
|
||||||
view_compute_bbox(view, extents->x1, extents->y1,
|
view_compute_bbox(view, extents, &damage);
|
||||||
extents->x2 - extents->x1,
|
|
||||||
extents->y2 - extents->y1,
|
|
||||||
&damage);
|
|
||||||
pixman_region32_translate(&damage,
|
pixman_region32_translate(&damage,
|
||||||
-view->plane->x,
|
-view->plane->x,
|
||||||
-view->plane->y);
|
-view->plane->y);
|
||||||
|
|||||||
Reference in New Issue
Block a user