[gtk/wip/otte/transform: 7/8] transform: Readd optimization



commit a8bf5eee0f9e5070284d524b60e17892a383894e
Author: Benjamin Otte <otte redhat com>
Date:   Mon Mar 4 21:43:44 2019 +0100

    transform: Readd optimization
    
    This is the optimization from bbd4e2f60d9e060fbe3b0c2dcebcd1d6b7335a2a

 gsk/gsktransform.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/gsk/gsktransform.c b/gsk/gsktransform.c
index a9c75c7599..b434d4cb31 100644
--- a/gsk/gsktransform.c
+++ b/gsk/gsktransform.c
@@ -1510,9 +1510,33 @@ gsk_transform_transform_bounds (GskTransform          *self,
                                 const graphene_rect_t *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;
+
+    case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
+      {
+        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;
 
-  /* XXX: vfuncify */
-  gsk_transform_to_matrix (self, &mat);
-  graphene_matrix_transform_bounds (&mat, rect, out_rect);
+        gsk_transform_to_matrix (self, &mat);
+        graphene_matrix_transform_bounds (&mat, rect, out_rect);
+      }
+      break;
+    }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]