[gtk/wip/otte/for-master: 1/3] transform: Add optimization for common case
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/for-master: 1/3] transform: Add optimization for common case
- Date: Fri, 21 Feb 2020 17:20:28 +0000 (UTC)
commit 41ef6e9fa5c22d3a889f82f5fe96f633cdd6959d
Author: Benjamin Otte <otte redhat com>
Date: Thu Feb 20 00:02:19 2020 +0100
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.
gsk/gsktransform.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/gsk/gsktransform.c b/gsk/gsktransform.c
index c8e0d321b7..df6cb63bdd 100644
--- a/gsk/gsktransform.c
+++ b/gsk/gsktransform.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]