[gtk/wip/baedert/for-master: 16/29] cssimage: Use gtk_internal_return_val_*



commit ce22ca71fcfbbaedc731a6193d255a448361751b
Author: Timm Bäder <mail baedert org>
Date:   Mon Aug 19 10:56:19 2019 +0200

    cssimage: Use gtk_internal_return_val_*
    
    GtkCssImage is not public and being used in hot paths, e.g. CSS.

 gtk/gtkcssimage.c | 63 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 32 insertions(+), 31 deletions(-)
---
diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c
index 6b4fc40a25..91507c0af4 100644
--- a/gtk/gtkcssimage.c
+++ b/gtk/gtkcssimage.c
@@ -23,6 +23,7 @@
 
 #include "gtkcssstyleprivate.h"
 #include "gtksnapshot.h"
+#include "gtkprivate.h"
 
 /* for the types only */
 #include "gtk/gtkcssimagecrossfadeprivate.h"
@@ -172,9 +173,9 @@ _gtk_css_image_compute (GtkCssImage      *image,
 {
   GtkCssImageClass *klass;
 
-  g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
-  g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
-  g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
+  gtk_internal_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
+  gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
+  gtk_internal_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
 
   klass = GTK_CSS_IMAGE_GET_CLASS (image);
 
@@ -189,8 +190,8 @@ _gtk_css_image_transition (GtkCssImage *start,
 {
   GtkCssImageClass *klass;
 
-  g_return_val_if_fail (start == NULL || GTK_IS_CSS_IMAGE (start), NULL);
-  g_return_val_if_fail (end == NULL || GTK_IS_CSS_IMAGE (end), NULL);
+  gtk_internal_return_val_if_fail (start == NULL || GTK_IS_CSS_IMAGE (start), NULL);
+  gtk_internal_return_val_if_fail (end == NULL || GTK_IS_CSS_IMAGE (end), NULL);
 
   progress = CLAMP (progress, 0.0, 1.0);
 
@@ -217,8 +218,8 @@ _gtk_css_image_equal (GtkCssImage *image1,
 {
   GtkCssImageClass *klass;
 
-  g_return_val_if_fail (image1 == NULL || GTK_IS_CSS_IMAGE (image1), FALSE);
-  g_return_val_if_fail (image2 == NULL || GTK_IS_CSS_IMAGE (image2), FALSE);
+  gtk_internal_return_val_if_fail (image1 == NULL || GTK_IS_CSS_IMAGE (image1), FALSE);
+  gtk_internal_return_val_if_fail (image2 == NULL || GTK_IS_CSS_IMAGE (image2), FALSE);
 
   if (image1 == image2)
     return TRUE;
@@ -243,10 +244,10 @@ _gtk_css_image_draw (GtkCssImage        *image,
   GtkSnapshot *snapshot;
   GskRenderNode *node;
 
-  g_return_if_fail (GTK_IS_CSS_IMAGE (image));
-  g_return_if_fail (cr != NULL);
-  g_return_if_fail (width > 0);
-  g_return_if_fail (height > 0);
+  gtk_internal_return_if_fail (GTK_IS_CSS_IMAGE (image));
+  gtk_internal_return_if_fail (cr != NULL);
+  gtk_internal_return_if_fail (width > 0);
+  gtk_internal_return_if_fail (height > 0);
 
   cairo_save (cr);
 
@@ -271,10 +272,10 @@ gtk_css_image_snapshot (GtkCssImage *image,
 {
   GtkCssImageClass *klass;
 
-  g_return_if_fail (GTK_IS_CSS_IMAGE (image));
-  g_return_if_fail (snapshot != NULL);
-  g_return_if_fail (width > 0);
-  g_return_if_fail (height > 0);
+  gtk_internal_return_if_fail (GTK_IS_CSS_IMAGE (image));
+  gtk_internal_return_if_fail (snapshot != NULL);
+  gtk_internal_return_if_fail (width > 0);
+  gtk_internal_return_if_fail (height > 0);
 
   klass = GTK_CSS_IMAGE_GET_CLASS (image);
 
@@ -286,7 +287,7 @@ gtk_css_image_is_invalid (GtkCssImage *image)
 {
   GtkCssImageClass *klass;
 
-  g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), FALSE);
+  gtk_internal_return_val_if_fail (GTK_IS_CSS_IMAGE (image), FALSE);
 
   klass = GTK_CSS_IMAGE_GET_CLASS (image);
 
@@ -298,7 +299,7 @@ gtk_css_image_is_dynamic (GtkCssImage *image)
 {
   GtkCssImageClass *klass;
 
-  g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), FALSE);
+  gtk_internal_return_val_if_fail (GTK_IS_CSS_IMAGE (image), FALSE);
 
   klass = GTK_CSS_IMAGE_GET_CLASS (image);
 
@@ -311,7 +312,7 @@ gtk_css_image_get_dynamic_image (GtkCssImage *image,
 {
   GtkCssImageClass *klass;
 
-  g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
+  gtk_internal_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
 
   klass = GTK_CSS_IMAGE_GET_CLASS (image);
 
@@ -324,8 +325,8 @@ _gtk_css_image_print (GtkCssImage *image,
 {
   GtkCssImageClass *klass;
 
-  g_return_if_fail (GTK_IS_CSS_IMAGE (image));
-  g_return_if_fail (string != NULL);
+  gtk_internal_return_if_fail (GTK_IS_CSS_IMAGE (image));
+  gtk_internal_return_if_fail (string != NULL);
 
   klass = GTK_CSS_IMAGE_GET_CLASS (image);
 
@@ -346,13 +347,13 @@ _gtk_css_image_get_concrete_size (GtkCssImage *image,
 {
   double image_width, image_height, image_aspect;
 
-  g_return_if_fail (GTK_IS_CSS_IMAGE (image));
-  g_return_if_fail (specified_width >= 0);
-  g_return_if_fail (specified_height >= 0);
-  g_return_if_fail (default_width > 0);
-  g_return_if_fail (default_height > 0);
-  g_return_if_fail (concrete_width != NULL);
-  g_return_if_fail (concrete_height != NULL);
+  gtk_internal_return_if_fail (GTK_IS_CSS_IMAGE (image));
+  gtk_internal_return_if_fail (specified_width >= 0);
+  gtk_internal_return_if_fail (specified_height >= 0);
+  gtk_internal_return_if_fail (default_width > 0);
+  gtk_internal_return_if_fail (default_height > 0);
+  gtk_internal_return_if_fail (concrete_width != NULL);
+  gtk_internal_return_if_fail (concrete_height != NULL);
 
   /* If the specified size is a definite width and height,
    * the concrete object size is given that width and height.
@@ -466,9 +467,9 @@ _gtk_css_image_get_surface (GtkCssImage     *image,
   cairo_surface_t *result;
   cairo_t *cr;
 
-  g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
-  g_return_val_if_fail (surface_width > 0, NULL);
-  g_return_val_if_fail (surface_height > 0, NULL);
+  gtk_internal_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
+  gtk_internal_return_val_if_fail (surface_width > 0, NULL);
+  gtk_internal_return_val_if_fail (surface_height > 0, NULL);
 
   if (target)
     result = cairo_surface_create_similar (target,
@@ -543,7 +544,7 @@ _gtk_css_image_new_parse (GtkCssParser *parser)
   GtkCssImage *image;
   GType image_type;
 
-  g_return_val_if_fail (parser != NULL, NULL);
+  gtk_internal_return_val_if_fail (parser != NULL, NULL);
 
   image_type = gtk_css_image_get_parser_type (parser);
   if (image_type == G_TYPE_INVALID)


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