transform: Readd optimization

This is the optimization from bbd4e2f60d
This commit is contained in:
Benjamin Otte 2019-03-04 21:43:44 +01:00
parent bd113aa85c
commit a8bf5eee0f

View File

@ -1510,9 +1510,33 @@ gsk_transform_transform_bounds (GskTransform *self,
const graphene_rect_t *rect, const graphene_rect_t *rect,
graphene_rect_t *out_rect) graphene_rect_t *out_rect)
{ {
graphene_matrix_t mat; switch (gsk_transform_get_category (self))
{
case GSK_TRANSFORM_CATEGORY_IDENTITY:
graphene_rect_init_from_rect (out_rect, rect);
break;
/* XXX: vfuncify */ case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
gsk_transform_to_matrix (self, &mat); {
graphene_matrix_transform_bounds (&mat, rect, out_rect); float dx, dy;
gsk_transform_to_translate (self, &dx, &dy);
graphene_rect_offset_r (rect, dx, dy, out_rect);
}
break;
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
case GSK_TRANSFORM_CATEGORY_ANY:
case GSK_TRANSFORM_CATEGORY_3D:
case GSK_TRANSFORM_CATEGORY_2D:
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
default:
{
graphene_matrix_t mat;
gsk_transform_to_matrix (self, &mat);
graphene_matrix_transform_bounds (&mat, rect, out_rect);
}
break;
}
} }