[gtk/wip/baedert/css-values: 70/102] Remove GtkCssRgbaValue



commit 67991ed0f405eca73e4c2f78f3e0d1c6c1a8de2c
Author: Timm Bäder <mail baedert org>
Date:   Fri Jan 10 13:02:33 2020 +0100

    Remove GtkCssRgbaValue
    
    The differenciation between a literal color value and an RGBA value
    caused problems in various situations. Just treat the two the same but
    don't allow access to the rgba value of a non-literal color value.
    
    This gets rid of around 1.6k rgba values in the widget-factory.

 gtk/gtkcsscolorvalue.c        |  96 +++++++++++++++++-------
 gtk/gtkcsscolorvalueprivate.h |   3 +
 gtk/gtkcssimagefallback.c     |   4 +-
 gtk/gtkcssimageicontheme.c    |   1 -
 gtk/gtkcssimagelinear.c       |   6 +-
 gtk/gtkcssimageradial.c       |   4 +-
 gtk/gtkcssimagerecolor.c      |   4 +-
 gtk/gtkcsspalettevalue.c      |   4 +-
 gtk/gtkcssrgbavalue.c         | 166 ------------------------------------------
 gtk/gtkcssrgbavalueprivate.h  |  38 ----------
 gtk/gtkcssshadowvalue.c       |  16 ++--
 gtk/gtkcssstyle.c             |   6 +-
 gtk/gtkcssstylepropertyimpl.c |   7 +-
 gtk/gtkicontheme.c            |   4 +-
 gtk/gtkrender.c               |   4 +-
 gtk/gtkrenderbackground.c     |   4 +-
 gtk/gtkrenderborder.c         |  12 +--
 gtk/gtksnapshot.c             |   4 +-
 gtk/gtkstylecontext.c         |   4 +-
 gtk/gtktreeview.c             |   6 +-
 gtk/gtkwindow.c               |   4 +-
 gtk/meson.build               |   1 -
 22 files changed, 119 insertions(+), 279 deletions(-)
---
diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c
index de0c765bb0..28154002a5 100644
--- a/gtk/gtkcsscolorvalue.c
+++ b/gtk/gtkcsscolorvalue.c
@@ -19,7 +19,6 @@
 
 #include "gtkcsscolorvalueprivate.h"
 
-#include "gtkcssrgbavalueprivate.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtkhslaprivate.h"
 #include "gtkprivate.h"
@@ -45,6 +44,7 @@ struct _GtkCssValue
   union
   {
     gchar *name;
+    GdkRGBA rgba;
 
     struct
     {
@@ -104,7 +104,7 @@ gtk_css_value_color_get_fallback (guint             property_id,
       case GTK_CSS_PROPERTY_TEXT_SHADOW:
       case GTK_CSS_PROPERTY_ICON_SHADOW:
       case GTK_CSS_PROPERTY_BOX_SHADOW:
-        return _gtk_css_rgba_value_new_transparent ();
+        return gtk_css_color_value_new_transparent ();
       case GTK_CSS_PROPERTY_COLOR:
       case GTK_CSS_PROPERTY_BACKGROUND_COLOR:
       case GTK_CSS_PROPERTY_BORDER_TOP_COLOR:
@@ -125,7 +125,7 @@ gtk_css_value_color_get_fallback (guint             property_id,
         if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES)
           g_warning ("No fallback color defined for property '%s'", 
                      _gtk_style_property_get_name (GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id 
(property_id))));
-        return _gtk_css_rgba_value_new_transparent ();
+        return gtk_css_color_value_new_transparent ();
     }
 }
 
@@ -158,7 +158,7 @@ gtk_css_value_color_compute (GtkCssValue      *value,
     }
   else if (value->type == COLOR_TYPE_LITERAL)
     {
-      resolved = _gtk_css_value_ref (value->last_value);
+      resolved = _gtk_css_value_ref (value);
     }
   else
     {
@@ -186,7 +186,7 @@ gtk_css_value_color_equal (const GtkCssValue *value1,
   switch (value1->type)
     {
     case COLOR_TYPE_LITERAL:
-      return _gtk_css_value_equal (value1->last_value, value2->last_value);
+      return gdk_rgba_equal (&value1->sym_col.rgba, &value2->sym_col.rgba);
     case COLOR_TYPE_NAME:
       return g_str_equal (value1->sym_col.name, value2->sym_col.name);
     case COLOR_TYPE_SHADE:
@@ -227,7 +227,11 @@ gtk_css_value_color_print (const GtkCssValue *value,
   switch (value->type)
     {
     case COLOR_TYPE_LITERAL:
-      _gtk_css_value_print (value->last_value, string);
+      {
+        char *s = gdk_rgba_to_string (&value->sym_col.rgba);
+        g_string_append (string, s);
+        g_free (s);
+      }
       break;
     case COLOR_TYPE_NAME:
       g_string_append (string, "@");
@@ -313,16 +317,32 @@ apply_shade (const GdkRGBA *in,
   _gdk_rgba_init_from_hsla (out, &hsla);
 }
 
+static inline double
+transition (double start,
+            double end,
+             double progress)
+{
+  return start + (end - start) * progress;
+}
+
 static void
 apply_mix (const GdkRGBA *in1,
            const GdkRGBA *in2,
            GdkRGBA       *out,
            double         factor)
 {
-  out->red   = CLAMP (in1->red   + ((in2->red   - in1->red)   * factor), 0, 1);
-  out->green = CLAMP (in1->green + ((in2->green - in1->green) * factor), 0, 1);
-  out->blue  = CLAMP (in1->blue  + ((in2->blue  - in1->blue)  * factor), 0, 1);
-  out->alpha = CLAMP (in1->alpha + ((in2->alpha - in1->alpha) * factor), 0, 1);
+  out->alpha = CLAMP (transition (in1->alpha, in2->alpha, factor), 0, 1);
+
+  if (out->alpha <= 0.0)
+    {
+      out->red = out->green = out->blue = 0.0;
+    }
+  else
+    {
+      out->red   = CLAMP (transition (in1->red * in1->alpha, in2->red * in2->alpha, factor), 0,  1) / 
out->alpha;
+      out->green = CLAMP (transition (in1->green * in1->alpha, in2->green * in2->alpha, factor), 0,  1) / 
out->alpha;
+      out->blue  = CLAMP (transition (in1->blue * in1->alpha, in2->blue * in2->alpha, factor), 0,  1) / 
out->alpha;
+    }
 }
 
 GtkCssValue *
@@ -338,7 +358,7 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
   switch (color->type)
     {
     case COLOR_TYPE_LITERAL:
-      return _gtk_css_value_ref (color->last_value);
+      return _gtk_css_value_ref (color);
     case COLOR_TYPE_NAME:
       {
        GtkCssValue *named;
@@ -368,11 +388,11 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
        if (val == NULL)
          return NULL;
 
-        apply_shade (_gtk_css_rgba_value_get_rgba (val), &shade, color->sym_col.shade.factor);
+        apply_shade (gtk_css_color_value_get_rgba (val), &shade, color->sym_col.shade.factor);
 
        _gtk_css_value_unref (val);
 
-       value = _gtk_css_rgba_value_new_from_rgba (&shade);
+        value = _gtk_css_color_value_new_literal (&shade);
       }
 
       break;
@@ -385,12 +405,12 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
        if (val == NULL)
          return NULL;
 
-       alpha = *_gtk_css_rgba_value_get_rgba (val);
+       alpha = *gtk_css_color_value_get_rgba (val);
         apply_alpha (&alpha, &alpha, color->sym_col.alpha.factor);
 
        _gtk_css_value_unref (val);
 
-       value = _gtk_css_rgba_value_new_from_rgba (&alpha);
+        value = _gtk_css_color_value_new_literal (&alpha);
       }
       break;
 
@@ -402,18 +422,18 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
        val = _gtk_css_color_value_resolve (color->sym_col.mix.color1, provider, current, cycle_list);
        if (val == NULL)
          return NULL;
-       color1 = *_gtk_css_rgba_value_get_rgba (val);
+       color1 = *gtk_css_color_value_get_rgba (val);
        _gtk_css_value_unref (val);
 
        val = _gtk_css_color_value_resolve (color->sym_col.mix.color2, provider, current, cycle_list);
        if (val == NULL)
          return NULL;
-       color2 = *_gtk_css_rgba_value_get_rgba (val);
+       color2 = *gtk_css_color_value_get_rgba (val);
        _gtk_css_value_unref (val);
 
         apply_mix (&color1, &color2, &res, color->sym_col.mix.factor);
 
-       value =_gtk_css_rgba_value_new_from_rgba (&res);
+        value = _gtk_css_color_value_new_literal (&res);
       }
 
       break;
@@ -460,6 +480,24 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
   return value;
 }
 
+static GtkCssValue transparent_black_singleton = { &GTK_CSS_VALUE_COLOR, 1, COLOR_TYPE_LITERAL, NULL,
+                                                   .sym_col.rgba = {0, 0, 0, 0} };
+static GtkCssValue white_singleton             = { &GTK_CSS_VALUE_COLOR, 1, COLOR_TYPE_LITERAL, NULL,
+                                                   .sym_col.rgba = {1, 1, 1, 1} };
+
+
+GtkCssValue *
+gtk_css_color_value_new_transparent (void)
+{
+  return _gtk_css_value_ref (&transparent_black_singleton);
+}
+
+GtkCssValue *
+gtk_css_color_value_new_white (void)
+{
+  return _gtk_css_value_ref (&white_singleton);
+}
+
 GtkCssValue *
 _gtk_css_color_value_new_literal (const GdkRGBA *color)
 {
@@ -469,7 +507,7 @@ _gtk_css_color_value_new_literal (const GdkRGBA *color)
 
   value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_COLOR);
   value->type = COLOR_TYPE_LITERAL;
-  value->last_value = _gtk_css_rgba_value_new_from_rgba (color);
+  value->sym_col.rgba = *color;
 
   return value;
 }
@@ -498,9 +536,9 @@ _gtk_css_color_value_new_shade (GtkCssValue *color,
 
   if (color->type == COLOR_TYPE_LITERAL)
     {
-      GdkRGBA c = *_gtk_css_rgba_value_get_rgba (color->last_value);
+      GdkRGBA c;
 
-      apply_shade (&c, &c, factor);
+      apply_shade (&color->sym_col.rgba, &c, factor);
 
       return _gtk_css_color_value_new_literal (&c);
     }
@@ -523,9 +561,9 @@ _gtk_css_color_value_new_alpha (GtkCssValue *color,
 
   if (color->type == COLOR_TYPE_LITERAL)
     {
-      GdkRGBA c = *_gtk_css_rgba_value_get_rgba (color->last_value);
+      GdkRGBA c;
 
-      apply_alpha (&c, &c, factor);
+      apply_alpha (&color->sym_col.rgba, &c, factor);
 
       return _gtk_css_color_value_new_literal (&c);
     }
@@ -551,11 +589,9 @@ _gtk_css_color_value_new_mix (GtkCssValue *color1,
   if (color1->type == COLOR_TYPE_LITERAL &&
       color2->type == COLOR_TYPE_LITERAL)
     {
-      GdkRGBA c1 = *_gtk_css_rgba_value_get_rgba (color1->last_value);
-      GdkRGBA c2 = *_gtk_css_rgba_value_get_rgba (color2->last_value);
       GdkRGBA result;
 
-      apply_mix (&c1, &c2, &result, factor);
+      apply_mix (&color1->sym_col.rgba, &color2->sym_col.rgba, &result, factor);
 
       return _gtk_css_color_value_new_literal (&result);
 
@@ -736,3 +772,11 @@ _gtk_css_color_value_parse (GtkCssParser *parser)
     return NULL;
 }
 
+const GdkRGBA *
+gtk_css_color_value_get_rgba (const GtkCssValue *color)
+{
+  g_assert (color->class == &GTK_CSS_VALUE_COLOR);
+  g_assert (color->type == COLOR_TYPE_LITERAL);
+
+  return &color->sym_col.rgba;
+}
diff --git a/gtk/gtkcsscolorvalueprivate.h b/gtk/gtkcsscolorvalueprivate.h
index 1007b26582..ce490c898a 100644
--- a/gtk/gtkcsscolorvalueprivate.h
+++ b/gtk/gtkcsscolorvalueprivate.h
@@ -24,6 +24,8 @@
 G_BEGIN_DECLS
 
 
+GtkCssValue *   gtk_css_color_value_new_transparent     (void);
+GtkCssValue *   gtk_css_color_value_new_white           (void);
 GtkCssValue *   _gtk_css_color_value_new_literal        (const GdkRGBA  *color);
 GtkCssValue *   _gtk_css_color_value_new_name           (const gchar    *name);
 GtkCssValue *   _gtk_css_color_value_new_shade          (GtkCssValue    *color,
@@ -42,6 +44,7 @@ GtkCssValue *   _gtk_css_color_value_resolve            (GtkCssValue      *color
                                                          GtkStyleProvider *provider,
                                                          GtkCssValue      *current,
                                                          GSList           *cycle_list);
+const GdkRGBA * gtk_css_color_value_get_rgba            (const GtkCssValue *color);
 
 
 G_END_DECLS
diff --git a/gtk/gtkcssimagefallback.c b/gtk/gtkcssimagefallback.c
index 6536a8dd0a..8d8ca30b52 100644
--- a/gtk/gtkcssimagefallback.c
+++ b/gtk/gtkcssimagefallback.c
@@ -21,7 +21,7 @@
 
 #include "gtkcssimagefallbackprivate.h"
 #include "gtkcsscolorvalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 
 #include "gtkstyleproviderprivate.h"
 
@@ -74,7 +74,7 @@ gtk_css_image_fallback_snapshot (GtkCssImage *image,
       const GdkRGBA *color;
 
       if (fallback->color)
-        color = _gtk_css_rgba_value_get_rgba (fallback->color);
+        color = gtk_css_color_value_get_rgba (fallback->color);
       else
         color = &red;
 
diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c
index 3832e8f34c..c2a21c41b9 100644
--- a/gtk/gtkcssimageicontheme.c
+++ b/gtk/gtkcssimageicontheme.c
@@ -24,7 +24,6 @@
 #include <math.h>
 
 #include "gtkcssiconthemevalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
 #include "gtksettingsprivate.h"
 #include "gtksnapshot.h"
 #include "gtkstyleproviderprivate.h"
diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c
index 16f52afe0f..df9efc8b6a 100644
--- a/gtk/gtkcssimagelinear.c
+++ b/gtk/gtkcssimagelinear.c
@@ -25,7 +25,7 @@
 
 #include "gtkcsscolorvalueprivate.h"
 #include "gtkcssnumbervalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkcssprovider.h"
 
 G_DEFINE_TYPE (GtkCssImageLinear, _gtk_css_image_linear, GTK_TYPE_CSS_IMAGE)
@@ -194,7 +194,7 @@ gtk_css_image_linear_snapshot (GtkCssImage        *image,
                                                              linear->stops->len - 1);
 
           gtk_snapshot_append_color (snapshot,
-                                     _gtk_css_rgba_value_get_rgba (stop->color),
+                                     gtk_css_color_value_get_rgba (stop->color),
                                      &GRAPHENE_RECT_INIT (0, 0, width, height));
           return;
         }
@@ -240,7 +240,7 @@ gtk_css_image_linear_snapshot (GtkCssImage        *image,
           offset += step;
 
           stops[last].offset = (offset - start) / (end - start);
-          stops[last].color = *_gtk_css_rgba_value_get_rgba (stop->color);
+          stops[last].color = *gtk_css_color_value_get_rgba (stop->color);
         }
 
       offset = pos;
diff --git a/gtk/gtkcssimageradial.c b/gtk/gtkcssimageradial.c
index 4dafe162ce..1fe21f62c5 100644
--- a/gtk/gtkcssimageradial.c
+++ b/gtk/gtkcssimageradial.c
@@ -26,7 +26,7 @@
 #include "gtkcsscolorvalueprivate.h"
 #include "gtkcssnumbervalueprivate.h"
 #include "gtkcsspositionvalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkcssprovider.h"
 
 G_DEFINE_TYPE (GtkCssImageRadial, _gtk_css_image_radial, GTK_TYPE_CSS_IMAGE)
@@ -208,7 +208,7 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
 
           stop = &g_array_index (radial->stops, GtkCssImageRadialColorStop, last);
 
-          rgba = _gtk_css_rgba_value_get_rgba (stop->color);
+          rgba = gtk_css_color_value_get_rgba (stop->color);
           offset += step;
 
           cairo_pattern_add_color_stop_rgba (pattern,
diff --git a/gtk/gtkcssimagerecolor.c b/gtk/gtkcssimagerecolor.c
index f9afa12f9e..36cc7bd9c4 100644
--- a/gtk/gtkcssimagerecolor.c
+++ b/gtk/gtkcssimagerecolor.c
@@ -22,7 +22,7 @@
 #include "gtkcssimagerecolorprivate.h"
 #include "gtkcssimageprivate.h"
 #include "gtkcsspalettevalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkiconthemeprivate.h"
 #include "gdkpixbufutilsprivate.h"
 
@@ -74,7 +74,7 @@ lookup_symbolic_colors (GtkCssStyle *style,
   const GdkRGBA *lookup;
 
   color = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
-  *color_out = *_gtk_css_rgba_value_get_rgba (color);
+  *color_out = *gtk_css_color_value_get_rgba (color);
 
   lookup = gtk_css_palette_value_get_color (palette, "success");
   if (lookup)
diff --git a/gtk/gtkcsspalettevalue.c b/gtk/gtkcsspalettevalue.c
index 53866bae76..e7daca9a74 100644
--- a/gtk/gtkcsspalettevalue.c
+++ b/gtk/gtkcsspalettevalue.c
@@ -21,7 +21,7 @@
 
 #include "gtkcssiconthemevalueprivate.h"
 #include "gtkcsscolorvalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkprivate.h"
 
 struct _GtkCssValue {
@@ -349,7 +349,7 @@ gtk_css_palette_value_get_color (GtkCssValue *value,
   for (i = 0; i < value->n_colors; i ++)
     {
       if (strcmp (value->color_names[i], name) == 0)
-        return _gtk_css_rgba_value_get_rgba (value->color_values[i]);
+        return gtk_css_color_value_get_rgba (value->color_values[i]);
     }
 
   return NULL;
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 79a2950b8e..709aff4023 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -23,7 +23,7 @@
 
 #include "gtkcsscolorvalueprivate.h"
 #include "gtkcssnumbervalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtksnapshotprivate.h"
 #include "gtkstylecontextprivate.h"
 #include "gtkpango.h"
@@ -197,7 +197,7 @@ _gtk_css_shadow_value_new_for_transition (GtkCssValue *target)
                                    _gtk_css_number_value_new (0, GTK_CSS_PX),
                                    _gtk_css_number_value_new (0, GTK_CSS_PX),
                                    target->inset,
-                                   _gtk_css_rgba_value_new_transparent ());
+                                   gtk_css_color_value_new_transparent ());
 }
 
 enum {
@@ -360,7 +360,7 @@ void
 gtk_css_shadow_value_get_shadow (const GtkCssValue *value,
                                  GskShadow         *shadow)
 {
-  shadow->color = *_gtk_css_rgba_value_get_rgba (value->color);
+  shadow->color = *gtk_css_color_value_get_rgba (value->color);
   shadow->dx = _gtk_css_number_value_get (value->hoffset, 0);
   shadow->dy = _gtk_css_number_value_get (value->voffset, 0);
   shadow->radius = _gtk_css_number_value_get (value->radius, 0);
@@ -374,12 +374,12 @@ gtk_css_shadow_value_snapshot_outset (const GtkCssValue    *shadow,
   g_return_if_fail (shadow->class == &GTK_CSS_VALUE_SHADOW);
 
   /* We don't need to draw invisible shadows */
-  if (gdk_rgba_is_clear (_gtk_css_rgba_value_get_rgba (shadow->color)))
+  if (gdk_rgba_is_clear (gtk_css_color_value_get_rgba (shadow->color)))
     return;
 
   gtk_snapshot_append_outset_shadow (snapshot,
                                      border_box,
-                                     _gtk_css_rgba_value_get_rgba (shadow->color),
+                                     gtk_css_color_value_get_rgba (shadow->color),
                                      _gtk_css_number_value_get (shadow->hoffset, 0),
                                      _gtk_css_number_value_get (shadow->voffset, 0),
                                      _gtk_css_number_value_get (shadow->spread, 0),
@@ -397,14 +397,14 @@ gtk_css_shadow_value_snapshot_inset (const GtkCssValue    *shadow,
   g_return_if_fail (shadow->class == &GTK_CSS_VALUE_SHADOW);
 
   /* We don't need to draw invisible shadows */
-  if (gdk_rgba_is_clear (_gtk_css_rgba_value_get_rgba (shadow->color)))
+  if (gdk_rgba_is_clear (gtk_css_color_value_get_rgba (shadow->color)))
     return;
 
   dx = _gtk_css_number_value_get (shadow->hoffset, 0);
   dy = _gtk_css_number_value_get (shadow->voffset, 0);
   spread = _gtk_css_number_value_get (shadow->spread, 0);
   radius = _gtk_css_number_value_get (shadow->radius, 0);
-  color = _gtk_css_rgba_value_get_rgba (shadow->color);
+  color = gtk_css_color_value_get_rgba (shadow->color);
 
   /* These are trivial to do with a color node */
   if (spread == 0 && radius == 0 &&
@@ -470,6 +470,6 @@ gtk_css_shadow_value_snapshot_inset (const GtkCssValue    *shadow,
 gboolean
 gtk_css_shadow_value_is_clear (const GtkCssValue *shadow)
 {
-  return gdk_rgba_is_clear (_gtk_css_rgba_value_get_rgba (shadow->color));
+  return gdk_rgba_is_clear (gtk_css_color_value_get_rgba (shadow->color));
 }
 
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index a20ee043c3..1456f1290d 100644
--- a/gtk/gtkcssstyle.c
+++ b/gtk/gtkcssstyle.c
@@ -28,7 +28,7 @@
 #include "gtkcssinheritvalueprivate.h"
 #include "gtkcssinitialvalueprivate.h"
 #include "gtkcssnumbervalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkcssshorthandpropertyprivate.h"
 #include "gtkcssstringvalueprivate.h"
 #include "gtkcssfontfeaturesvalueprivate.h"
@@ -227,8 +227,8 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
   /* text-decoration */
   decoration_line = _gtk_css_text_decoration_line_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_TEXT_DECORATION_LINE));
   decoration_style = _gtk_css_text_decoration_style_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE));
-  color = _gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
-  decoration_color = _gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR));
+  color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
+  decoration_color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR));
 
   switch (decoration_line)
     {
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 02e9521403..eee5bfbde3 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -53,7 +53,6 @@
 #include "gtkcsspalettevalueprivate.h"
 #include "gtkcsspositionvalueprivate.h"
 #include "gtkcssrepeatvalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
 #include "gtkcssshadowsvalueprivate.h"
 #include "gtkcssstringvalueprivate.h"
 #include "gtkcsstransformvalueprivate.h"
@@ -150,7 +149,7 @@ color_query (GtkCssStyleProperty *property,
              GValue              *value)
 {
   g_value_init (value, GDK_TYPE_RGBA);
-  g_value_set_boxed (value, _gtk_css_rgba_value_get_rgba (css_value));
+  g_value_set_boxed (value, gtk_css_color_value_get_rgba (css_value));
 }
 
 static GtkCssValue *
@@ -936,7 +935,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_AFFECTS_CONTENT | GTK_CSS_AFFECTS_SYMBOLIC_ICON,
                                           color_parse,
                                           color_query,
-                                          _gtk_css_rgba_value_new_white ());
+                                          gtk_css_color_value_new_white ());
   gtk_css_style_property_register        ("-gtk-dpi",
                                           GTK_CSS_PROPERTY_DPI,
                                           G_TYPE_NONE,
@@ -980,7 +979,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_AFFECTS_BACKGROUND,
                                           color_parse,
                                           color_query,
-                                          _gtk_css_rgba_value_new_transparent ());
+                                          gtk_css_color_value_new_transparent ());
 
   gtk_css_style_property_register        ("font-family",
                                           GTK_CSS_PROPERTY_FONT_FAMILY,
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 8a2231e6e1..5de6c07f39 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -40,7 +40,7 @@
 
 #include "gtkiconthemeprivate.h"
 #include "gtkcsspalettevalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkdebug.h"
 #include "gtkiconcacheprivate.h"
 #include "gtkintl.h"
@@ -3868,7 +3868,7 @@ gtk_icon_theme_lookup_symbolic_colors (GtkCssStyle *style,
 
   color = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
   palette = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_PALETTE);
-  *color_out = *_gtk_css_rgba_value_get_rgba (color);
+  *color_out = *gtk_css_color_value_get_rgba (color);
 
   lookup = gtk_css_palette_value_get_color (palette, "success");
   if (lookup)
diff --git a/gtk/gtkrender.c b/gtk/gtkrender.c
index 40e1a47467..ade2358bea 100644
--- a/gtk/gtkrender.c
+++ b/gtk/gtkrender.c
@@ -24,7 +24,7 @@
 #include "gtkcsscornervalueprivate.h"
 #include "gtkcssimagevalueprivate.h"
 #include "gtkcssnumbervalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkcssshadowsvalueprivate.h"
 #include "gtkcsstransformvalueprivate.h"
 #include "gtkhslaprivate.h"
@@ -414,7 +414,7 @@ gtk_do_render_line (GtkStyleContext *context,
 
   cairo_save (cr);
 
-  color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
+  color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
 
   cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
   cairo_set_line_width (cr, 1);
diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c
index b241a7e615..30d620c3ed 100644
--- a/gtk/gtkrenderbackground.c
+++ b/gtk/gtkrenderbackground.c
@@ -33,7 +33,7 @@
 #include "gtkcssshadowsvalueprivate.h"
 #include "gtkcsspositionvalueprivate.h"
 #include "gtkcssrepeatvalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkcssstyleprivate.h"
 #include "gtkcsstypesprivate.h"
 
@@ -278,7 +278,7 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
   GskBlendMode *blend_mode_values;
 
   background_image = gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BACKGROUND_IMAGE);
-  bg_color = _gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BACKGROUND_COLOR));
+  bg_color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BACKGROUND_COLOR));
   box_shadow = gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BOX_SHADOW);
 
   /* This is the common default case of no background */
diff --git a/gtk/gtkrenderborder.c b/gtk/gtkrenderborder.c
index 45c4e25321..232418ad64 100644
--- a/gtk/gtkrenderborder.c
+++ b/gtk/gtkrenderborder.c
@@ -31,7 +31,7 @@
 #include "gtkcssimagevalueprivate.h"
 #include "gtkcssnumbervalueprivate.h"
 #include "gtkcssrepeatvalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkcssstyleprivate.h"
 #include "gtkhslaprivate.h"
 #include "gtkroundedboxprivate.h"
@@ -683,10 +683,10 @@ gtk_css_style_snapshot_border (GtkCssBoxes *boxes,
                                gtk_css_boxes_get_padding_rect (boxes)))
         return;
 
-      colors[0] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
-      colors[1] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR));
-      colors[2] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR));
-      colors[3] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_LEFT_COLOR));
+      colors[0] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
+      colors[1] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR));
+      colors[2] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR));
+      colors[3] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_LEFT_COLOR));
 
       alpha_test_vector = graphene_simd4f_init (colors[0].alpha, colors[1].alpha, colors[2].alpha, 
colors[3].alpha);
       if (graphene_simd4f_is_zero4 (alpha_test_vector))
@@ -726,7 +726,7 @@ gtk_css_style_snapshot_outline (GtkCssBoxes *boxes,
       border_style[1] = border_style[2] = border_style[3] = border_style[0];
       border_width[0] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_OUTLINE_WIDTH), 100);
       border_width[3] = border_width[2] = border_width[1] = border_width[0];
-      colors[0] = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_OUTLINE_COLOR));
+      colors[0] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_OUTLINE_COLOR));
       colors[3] = colors[2] = colors[1] = colors[0];
 
       snapshot_border (snapshot,
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index b1bee0fba9..394d8980f2 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -20,7 +20,7 @@
 #include "gtksnapshot.h"
 #include "gtksnapshotprivate.h"
 
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkcssshadowsvalueprivate.h"
 #include "gtkdebug.h"
 #include "gtkrenderbackgroundprivate.h"
@@ -1732,7 +1732,7 @@ gtk_snapshot_render_layout (GtkSnapshot     *snapshot,
   gtk_snapshot_save (snapshot);
   gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
 
-  fg_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_COLOR));
+  fg_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_COLOR));
 
   shadows_value = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_TEXT_SHADOW);
   has_shadow = gtk_css_shadows_value_push_snapshot (shadows_value, snapshot);
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 2072dd8a3b..bacdf3ec33 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -31,7 +31,7 @@
 #include "gtkcssnodeprivate.h"
 #include "gtkcssnumbervalueprivate.h"
 #include "gtkcsspathnodeprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkcsscolorvalueprivate.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtkcsstransientnodeprivate.h"
@@ -1346,7 +1346,7 @@ gtk_style_context_resolve_color (GtkStyleContext    *context,
   if (val == NULL)
     return FALSE;
 
-  *result = *_gtk_css_rgba_value_get_rgba (val);
+  *result = *gtk_css_color_value_get_rgba (val);
   _gtk_css_value_unref (val);
   return TRUE;
 }
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 56124d6296..e687a71e4b 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -29,7 +29,7 @@
 #include "gtkcellrenderer.h"
 #include "gtkcontainer.h"
 #include "gtkcssnumbervalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtkdragdest.h"
 #include "gtkdragsource.h"
@@ -4216,7 +4216,7 @@ gtk_tree_view_snapshot_grid_line (GtkTreeView            *tree_view,
   const GdkRGBA *grid_line_color;
 
   context = gtk_widget_get_style_context (GTK_WIDGET (tree_view));
-  grid_line_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context,
+  grid_line_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context,
                                                                                     
GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
 
   if (!gdk_rgba_equal (grid_line_color, &tree_view->grid_line_color) ||
@@ -4290,7 +4290,7 @@ gtk_tree_view_snapshot_tree_line (GtkTreeView            *tree_view,
   const GdkRGBA *tree_line_color;
 
   context = gtk_widget_get_style_context (GTK_WIDGET (tree_view));
-  tree_line_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context,
+  tree_line_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context,
                                                                                     
GTK_CSS_PROPERTY_BORDER_LEFT_COLOR));
 
   if (!gdk_rgba_equal (tree_line_color, &tree_view->tree_line_color) ||
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index c0a5067a52..893c58ae5c 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -37,7 +37,7 @@
 #include "gtkcontainerprivate.h"
 #include "gtkcsscornervalueprivate.h"
 #include "gtkcssiconthemevalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
 #include "gtkcssshadowsvalueprivate.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtkdragdest.h"
@@ -5459,7 +5459,7 @@ update_opaque_region (GtkWindow           *window,
 
   context = gtk_widget_get_style_context (widget);
 
-  is_opaque = gdk_rgba_is_opaque (_gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_BACKGROUND_COLOR)));
+  is_opaque = gdk_rgba_is_opaque (gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_BACKGROUND_COLOR)));
 
   if (gtk_widget_get_opacity (widget) < 1.0)
     is_opaque = FALSE;
diff --git a/gtk/meson.build b/gtk/meson.build
index 6f498f54f0..0efbd5fac0 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -82,7 +82,6 @@ gtk_private_sources = files([
   'gtkcsspathnode.c',
   'gtkcsspositionvalue.c',
   'gtkcssrepeatvalue.c',
-  'gtkcssrgbavalue.c',
   'gtkcssselector.c',
   'gtkcssshadowsvalue.c',
   'gtkcssshadowvalue.c',


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