forked from AuroraMiddleware/gtk
Add gsk_matrix_transform_rect
This is a projecting version of the corresponding graphene api. While we are at it, rewrite gsk_matrix_transform_bounds() to use gsk_matrix_transform_rect().
This commit is contained in:
parent
bb2a0e69f4
commit
41497aeb8b
@ -2204,13 +2204,11 @@ gsk_matrix_transform_point3d (const graphene_matrix_t *m,
|
||||
}
|
||||
|
||||
void
|
||||
gsk_matrix_transform_bounds (const graphene_matrix_t *m,
|
||||
const graphene_rect_t *r,
|
||||
graphene_rect_t *res)
|
||||
gsk_matrix_transform_rect (const graphene_matrix_t *m,
|
||||
const graphene_rect_t *r,
|
||||
graphene_quad_t *res)
|
||||
{
|
||||
graphene_point_t ret[4];
|
||||
float min_x, min_y;
|
||||
float max_x, max_y;
|
||||
graphene_rect_t rr;
|
||||
|
||||
graphene_rect_normalize_r (r, &rr);
|
||||
@ -2233,12 +2231,15 @@ gsk_matrix_transform_bounds (const graphene_matrix_t *m,
|
||||
|
||||
#undef TRANSFORM_POINT
|
||||
|
||||
/* FIXME: graphene doesn't export a fast way to do this */
|
||||
min_x = MIN (MIN (ret[0].x, ret[1].x), MIN (ret[2].x, ret[3].x));
|
||||
min_y = MIN (MIN (ret[0].y, ret[1].y), MIN (ret[2].y, ret[3].y));
|
||||
|
||||
max_x = MAX (MAX (ret[0].x, ret[1].x), MAX (ret[2].x, ret[3].x));
|
||||
max_y = MAX (MAX (ret[0].y, ret[1].y), MAX (ret[2].y, ret[3].y));
|
||||
|
||||
graphene_rect_init (res, min_x, min_y, max_x - min_x, max_y - min_y);
|
||||
graphene_quad_init (res, &ret[0], &ret[1], &ret[2], &ret[3]);
|
||||
}
|
||||
void
|
||||
gsk_matrix_transform_bounds (const graphene_matrix_t *m,
|
||||
const graphene_rect_t *r,
|
||||
graphene_rect_t *res)
|
||||
{
|
||||
graphene_quad_t q;
|
||||
|
||||
gsk_matrix_transform_rect (m, r, &q);
|
||||
graphene_quad_bounds (&q, res);
|
||||
}
|
||||
|
@ -41,7 +41,9 @@ void gsk_matrix_transform_point3d (const graphene_matrix_t *m,
|
||||
void gsk_matrix_transform_bounds (const graphene_matrix_t *m,
|
||||
const graphene_rect_t *r,
|
||||
graphene_rect_t *res);
|
||||
|
||||
void gsk_matrix_transform_rect (const graphene_matrix_t *m,
|
||||
const graphene_rect_t *r,
|
||||
graphene_quad_t *res);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user