transform: Add optimization for common case
Transforming identity by an other transform does not mean we need to painstakingly apply the individual steps of other to construct a new transform, it means we can just return other. Or in math terms: I * B = B so just return B.
This commit is contained in:
@@ -1622,6 +1622,12 @@ gsk_transform_transform (GskTransform *next,
|
||||
if (other == NULL)
|
||||
return next;
|
||||
|
||||
if (gsk_transform_is_identity (next))
|
||||
{
|
||||
gsk_transform_unref (next);
|
||||
return gsk_transform_ref (other);
|
||||
}
|
||||
|
||||
next = gsk_transform_transform (next, other->next);
|
||||
return other->transform_class->apply (other, next);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user