[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:07:43 +0000 (UTC)
commit 0f337310123a07b55c87bd4766aa188f5307210d
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..c93e3ac2bc 100644
--- a/gsk/gsktransform.c
+++ b/gsk/gsktransform.c
@@ -1619,6 +1619,12 @@ GskTransform *
gsk_transform_transform (GskTransform *next,
GskTransform *other)
{
+ if (gsk_transform_is_identity (next))
+ {
+ gsk_transform_unref (next);
+ return gsk_transform_ref (other);
+ }
+
if (other == NULL)
return next;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]