[gtk/wip/baedert/for-master] gsk: Make a few functions G_GNUC_PURE



commit 2a439ff94d7913dd7501f044e972351de6931079
Author: Timm Bäder <mail baedert org>
Date:   Fri Jan 24 12:51:01 2020 +0100

    gsk: Make a few functions G_GNUC_PURE

 gsk/gl/gskglrenderer.c      |  6 +++---
 gsk/gskrendernode.c         |  8 ++++----
 gsk/gskrendernodeimpl.c     | 18 +++++++++---------
 gsk/gskrendernodeprivate.h  |  8 ++++----
 gsk/gskroundedrect.h        |  8 ++++----
 gsk/gskroundedrectprivate.h |  2 +-
 6 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index d0ca63b88c..0dafe12c10 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -196,7 +196,7 @@ dump_node (GskRenderNode *node,
   cairo_surface_destroy (surface);
 }
 
-static inline gboolean
+static inline gboolean G_GNUC_PURE
 node_is_invisible (const GskRenderNode *node)
 {
   return node->bounds.size.width == 0.0f ||
@@ -237,7 +237,7 @@ sort_border_sides (const GdkRGBA *colors,
     }
 }
 
-static inline gboolean
+static inline gboolean G_GNUC_PURE
 color_matrix_modifies_alpha (GskRenderNode *node)
 {
   const graphene_matrix_t *matrix = gsk_color_matrix_node_peek_color_matrix (node);
@@ -261,7 +261,7 @@ gsk_rounded_rect_shrink_to_minimum (GskRoundedRect *self)
                                          MAX (self->corner[2].height, self->corner[3].height)) * 2);
 }
 
-static inline gboolean
+static inline gboolean G_GNUC_PURE
 node_supports_transform (GskRenderNode *node)
 {
   /* Some nodes can't handle non-trivial transforms without being
diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c
index 20fe92894e..9646049da4 100644
--- a/gsk/gskrendernode.c
+++ b/gsk/gskrendernode.c
@@ -145,9 +145,9 @@ gsk_render_node_get_node_type (GskRenderNode *node)
   return node->node_class->node_type;
 }
 
-static inline
+G_GNUC_PURE static inline
 GskRenderNodeType
-_gsk_render_node_get_node_type (GskRenderNode *node)
+_gsk_render_node_get_node_type (const GskRenderNode *node)
 {
   return node->node_class->node_type;
 }
@@ -248,8 +248,8 @@ gsk_render_node_draw (GskRenderNode *node,
  * Returns: %TRUE if @node1 and @node2 can be expected to be compared
  **/
 gboolean
-gsk_render_node_can_diff (GskRenderNode *node1,
-                          GskRenderNode *node2)
+gsk_render_node_can_diff (const GskRenderNode *node1,
+                          const GskRenderNode *node2)
 {
   if (node1 == node2)
     return TRUE;
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index d0902845d5..2434c5d40e 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -41,8 +41,8 @@ rectangle_init_from_graphene (cairo_rectangle_int_t *cairo,
 }
 
 static gboolean
-gsk_render_node_can_diff_true (GskRenderNode *node1,
-                               GskRenderNode *node2)
+gsk_render_node_can_diff_true (const GskRenderNode *node1,
+                               const GskRenderNode *node2)
 {
   return TRUE;
 }
@@ -1707,8 +1707,8 @@ gsk_container_node_draw (GskRenderNode *node,
 }
 
 static gboolean
-gsk_container_node_can_diff (GskRenderNode *node1,
-                             GskRenderNode *node2)
+gsk_container_node_can_diff (const GskRenderNode *node1,
+                             const GskRenderNode *node2)
 {
   return TRUE;
 }
@@ -1726,7 +1726,7 @@ gsk_render_node_add_to_region (GskRenderNode  *node,
 static int
 gsk_container_node_compare_func (gconstpointer elem1, gconstpointer elem2, gpointer data)
 {
-  return gsk_render_node_can_diff ((GskRenderNode *) elem1, (GskRenderNode *) elem2) ? 0 : 1;
+  return gsk_render_node_can_diff ((const GskRenderNode *) elem1, (const GskRenderNode *) elem2) ? 0 : 1;
 }
 
 static void
@@ -1918,8 +1918,8 @@ gsk_transform_node_draw (GskRenderNode *node,
 }
 
 static gboolean
-gsk_transform_node_can_diff (GskRenderNode *node1,
-                             GskRenderNode *node2)
+gsk_transform_node_can_diff (const GskRenderNode *node1,
+                             const GskRenderNode *node2)
 {
   GskTransformNode *self1 = (GskTransformNode *) node1;
   GskTransformNode *self2 = (GskTransformNode *) node2;
@@ -2092,8 +2092,8 @@ gsk_debug_node_draw (GskRenderNode *node,
 }
 
 static gboolean
-gsk_debug_node_can_diff (GskRenderNode *node1,
-                         GskRenderNode *node2)
+gsk_debug_node_can_diff (const GskRenderNode *node1,
+                         const GskRenderNode *node2)
 {
   GskDebugNode *self1 = (GskDebugNode *) node1;
   GskDebugNode *self2 = (GskDebugNode *) node2;
diff --git a/gsk/gskrendernodeprivate.h b/gsk/gskrendernodeprivate.h
index 2ced79738b..83d01740a5 100644
--- a/gsk/gskrendernodeprivate.h
+++ b/gsk/gskrendernodeprivate.h
@@ -28,8 +28,8 @@ struct _GskRenderNodeClass
   void            (* finalize)    (GskRenderNode  *node);
   void            (* draw)        (GskRenderNode  *node,
                                    cairo_t        *cr);
-  gboolean        (* can_diff)    (GskRenderNode  *node1,
-                                   GskRenderNode  *node2);
+  gboolean        (* can_diff)    (const GskRenderNode  *node1,
+                                   const GskRenderNode  *node2);
   void            (* diff)        (GskRenderNode  *node1,
                                    GskRenderNode  *node2,
                                    cairo_region_t *region);
@@ -38,8 +38,8 @@ struct _GskRenderNodeClass
 GskRenderNode * gsk_render_node_new              (const GskRenderNodeClass  *node_class,
                                                   gsize                      extra_size);
 
-gboolean        gsk_render_node_can_diff         (GskRenderNode             *node1,
-                                                  GskRenderNode             *node2);
+gboolean        gsk_render_node_can_diff         (const GskRenderNode       *node1,
+                                                  const GskRenderNode       *node2) G_GNUC_PURE;
 void            gsk_render_node_diff             (GskRenderNode             *node1,
                                                   GskRenderNode             *node2,
                                                   cairo_region_t            *region);
diff --git a/gsk/gskroundedrect.h b/gsk/gskroundedrect.h
index d942df5169..64945a1417 100644
--- a/gsk/gskroundedrect.h
+++ b/gsk/gskroundedrect.h
@@ -98,16 +98,16 @@ GskRoundedRect *        gsk_rounded_rect_shrink                 (GskRoundedRect
                                                                  float                     left);
 
 GDK_AVAILABLE_IN_ALL
-gboolean                gsk_rounded_rect_is_rectilinear         (const GskRoundedRect     *self);
+gboolean                gsk_rounded_rect_is_rectilinear         (const GskRoundedRect     *self) G_GNUC_PURE;
 GDK_AVAILABLE_IN_ALL
 gboolean                gsk_rounded_rect_contains_point         (const GskRoundedRect     *self,
-                                                                 const graphene_point_t   *point);
+                                                                 const graphene_point_t   *point) 
G_GNUC_PURE;
 GDK_AVAILABLE_IN_ALL
 gboolean                gsk_rounded_rect_contains_rect          (const GskRoundedRect     *self,
-                                                                 const graphene_rect_t    *rect);
+                                                                 const graphene_rect_t    *rect) G_GNUC_PURE;
 GDK_AVAILABLE_IN_ALL
 gboolean                gsk_rounded_rect_intersects_rect        (const GskRoundedRect     *self,
-                                                                 const graphene_rect_t    *rect);
+                                                                 const graphene_rect_t    *rect) G_GNUC_PURE;
 
 G_END_DECLS
 
diff --git a/gsk/gskroundedrectprivate.h b/gsk/gskroundedrectprivate.h
index 1284d8e7ea..5c2912b492 100644
--- a/gsk/gskroundedrectprivate.h
+++ b/gsk/gskroundedrectprivate.h
@@ -15,7 +15,7 @@ void                     gsk_rounded_rect_to_float              (const GskRounde
                                                                  float                     rect[12]);
 
 gboolean                 gsk_rounded_rect_equal                 (gconstpointer             rect1,
-                                                                 gconstpointer             rect2);
+                                                                 gconstpointer             rect2) 
G_GNUC_PURE;
 char *                   gsk_rounded_rect_to_string             (const GskRoundedRect     *self);
 
 


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