[gtk/matthiasc/css-values] Remove GtkCssRgbaValue
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/css-values] Remove GtkCssRgbaValue
- Date: Fri, 10 Jan 2020 16:24:24 +0000 (UTC)
commit 9d57af8f9115c9459a010df8de2ce535cf246808
Author: Timm Bäder <tbaeder redhat com>
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.
gtk/gtkcsscolorvalue.c | 71 ++++++++++++++++++++++++++++++-------------
gtk/gtkcsscolorvalueprivate.h | 3 ++
gtk/gtkcssimagebuiltin.c | 6 ++--
gtk/gtkcssimagefallback.c | 4 +--
gtk/gtkcssimagelinear.c | 6 ++--
gtk/gtkcssimageradial.c | 4 +--
gtk/gtkcssimagerecolor.c | 4 +--
gtk/gtkcsspalettevalue.c | 4 +--
gtk/gtkcssshadowvalue.c | 16 +++++-----
gtk/gtkcssstyle.c | 6 ++--
gtk/gtkcssstylepropertyimpl.c | 6 ++--
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 +--
19 files changed, 102 insertions(+), 70 deletions(-)
---
diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c
index de0c765bb0..450bf9f0ca 100644
--- a/gtk/gtkcsscolorvalue.c
+++ b/gtk/gtkcsscolorvalue.c
@@ -45,6 +45,7 @@ struct _GtkCssValue
union
{
gchar *name;
+ GdkRGBA rgba;
struct
{
@@ -104,7 +105,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 +126,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 +159,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 +187,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 +228,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, "@");
@@ -338,7 +343,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 +373,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 +390,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 +407,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 +465,24 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
return value;
}
+static GtkCssValue transparent_black_singleton = { >K_CSS_VALUE_COLOR, 1, COLOR_TYPE_LITERAL, NULL,
+ .sym_col.rgba = {0, 0, 0, 0} };
+static GtkCssValue white_singleton = { >K_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 +492,7 @@ _gtk_css_color_value_new_literal (const GdkRGBA *color)
value = _gtk_css_value_new (GtkCssValue, >K_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 +521,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 +546,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 +574,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 +757,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 == >K_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/gtkcssimagebuiltin.c b/gtk/gtkcssimagebuiltin.c
index e005eb6e2a..fd15310fa5 100644
--- a/gtk/gtkcssimagebuiltin.c
+++ b/gtk/gtkcssimagebuiltin.c
@@ -23,7 +23,7 @@
#include "gtkcssenumvalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
#include "gtkcssstyleprivate.h"
#include "gtkhslaprivate.h"
@@ -484,8 +484,8 @@ gtk_css_image_builtin_compute (GtkCssImage *image,
result = g_object_new (GTK_TYPE_CSS_IMAGE_BUILTIN, NULL);
- result->fg_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
- result->bg_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style,
GTK_CSS_PROPERTY_BACKGROUND_COLOR));
+ result->fg_color = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
+ result->bg_color = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (style,
GTK_CSS_PROPERTY_BACKGROUND_COLOR));
return GTK_CSS_IMAGE (result);
}
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/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 9f44d5f0b1..5f939ef99b 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 == >K_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 == >K_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,7 +470,7 @@ 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));
}
gboolean
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index 835a2b4213..21054d1ee2 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"
@@ -219,8 +219,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 5a36b933cb..84c6d7c75c 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -151,7 +151,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 *
@@ -947,7 +947,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,
@@ -991,7 +991,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 4a79febdee..1351cc557f 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"
@@ -3870,7 +3870,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 78372e8d0c..1a40389669 100644
--- a/gtk/gtkrender.c
+++ b/gtk/gtkrender.c
@@ -25,7 +25,7 @@
#include "gtkcssimagebuiltinprivate.h"
#include "gtkcssimagevalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsscolorvalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcsstransformvalueprivate.h"
#include "gtkhslaprivate.h"
@@ -490,7 +490,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 6d4709cc5d..dbb09ecaab 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"
@@ -4213,7 +4213,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) ||
@@ -4287,7 +4287,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 3901f2bb80..f5a0bdedcf 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"
@@ -5460,7 +5460,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]