[gtk/wip/baedert/for-master: 1/2] gl renderer: Check for pointer equality in rounded_rect_equal




commit 526c76181ece9c6ca966431bd07d46b003d500b4
Author: Timm Bäder <mail baedert org>
Date:   Mon Dec 21 14:13:48 2020 +0100

    gl renderer: Check for pointer equality in rounded_rect_equal

 gsk/gl/gskglrenderops.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index d7639162ad..8bd420e7bd 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -14,27 +14,28 @@ rect_equal (const graphene_rect_t *a,
   return memcmp (a, b, sizeof (graphene_rect_t)) == 0;
 }
 
-static inline gboolean G_GNUC_PURE
+static inline bool G_GNUC_PURE
 rounded_rect_equal (const GskRoundedRect *r1,
                     const GskRoundedRect *r2)
 {
-  int i;
+  if (r1 == r2)
+      return true;
 
   if (!r1)
-    return FALSE;
+    return false;
 
   if (r1->bounds.origin.x != r2->bounds.origin.x ||
       r1->bounds.origin.y != r2->bounds.origin.y ||
       r1->bounds.size.width != r2->bounds.size.width ||
       r1->bounds.size.height != r2->bounds.size.height)
-    return FALSE;
+    return false;
 
-  for (i = 0; i < 4; i ++)
+  for (int i = 0; i < 4; i ++)
     if (r1->corner[i].width != r2->corner[i].width ||
         r1->corner[i].height != r2->corner[i].height)
-      return FALSE;
+      return false;
 
-  return TRUE;
+  return true;
 }
 
 static inline gboolean G_GNUC_PURE


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