[gtk+] css: Stop parsing GdkColor values
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css: Stop parsing GdkColor values
- Date: Sat, 22 Oct 2016 17:08:03 +0000 (UTC)
commit 145387add55b3e76ebb5efb215a4b08a7e1245e7
Author: Timm Bäder <mail baedert org>
Date: Sat Oct 22 16:49:42 2016 +0200
css: Stop parsing GdkColor values
gtk/gtkcssstylefuncs.c | 58 ------------------------------------------------
gtk/gtkstylecontext.c | 23 +++---------------
2 files changed, 4 insertions(+), 77 deletions(-)
---
diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c
index 24531ea..301b052 100644
--- a/gtk/gtkcssstylefuncs.c
+++ b/gtk/gtkcssstylefuncs.c
@@ -171,60 +171,6 @@ rgba_value_print (const GValue *value,
}
static gboolean
-color_value_parse (GtkCssParser *parser,
- GValue *value)
-{
- GtkSymbolicColor *symbolic;
- GdkRGBA rgba;
-
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
- symbolic = _gtk_css_symbolic_value_new (parser);
- if (symbolic == NULL)
- return FALSE;
-
- if (gtk_symbolic_color_resolve (symbolic, &rgba))
- {
- GdkColor color;
-
- color.red = rgba.red * 65535. + 0.5;
- color.green = rgba.green * 65535. + 0.5;
- color.blue = rgba.blue * 65535. + 0.5;
-
- g_value_set_boxed (value, &color);
- gtk_symbolic_color_unref (symbolic);
- }
- else
- {
- g_value_unset (value);
- g_value_init (value, GTK_TYPE_SYMBOLIC_COLOR);
- g_value_take_boxed (value, symbolic);
- }
-
- G_GNUC_END_IGNORE_DEPRECATIONS;
-
- return TRUE;
-}
-
-static void
-color_value_print (const GValue *value,
- GString *string)
-{
- const GdkColor *color = g_value_get_boxed (value);
-
- if (color == NULL)
- g_string_append (string, "none");
- else
- {
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- char *s = gdk_color_to_string (color);
-G_GNUC_END_IGNORE_DEPRECATIONS
- g_string_append (string, s);
- g_free (s);
- }
-}
-
-static gboolean
symbolic_color_value_parse (GtkCssParser *parser,
GValue *value)
{
@@ -802,10 +748,6 @@ gtk_css_style_funcs_init (void)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- register_conversion_function (GDK_TYPE_COLOR,
- color_value_parse,
- color_value_print);
-
register_conversion_function (GTK_TYPE_SYMBOLIC_COLOR,
symbolic_color_value_parse,
symbolic_color_value_print);
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 07ed5a7..326d7ab 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -1410,7 +1410,7 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- /* Resolve symbolic colors to GdkColor/GdkRGBA */
+ /* Resolve symbolic colors to GdkRGBA */
if (G_VALUE_TYPE (&pcache->value) == GTK_TYPE_SYMBOLIC_COLOR)
{
GtkSymbolicColor *color;
@@ -1420,26 +1420,11 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
g_value_unset (&pcache->value);
- if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
- g_value_init (&pcache->value, GDK_TYPE_RGBA);
- else
- g_value_init (&pcache->value, GDK_TYPE_COLOR);
+ g_assert (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA);
+ g_value_init (&pcache->value, GDK_TYPE_RGBA);
if (_gtk_style_context_resolve_color (context, _gtk_symbolic_color_get_css_value (color),
&rgba))
- {
- if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
- g_value_set_boxed (&pcache->value, &rgba);
- else
- {
- GdkColor rgb;
-
- rgb.red = rgba.red * 65535. + 0.5;
- rgb.green = rgba.green * 65535. + 0.5;
- rgb.blue = rgba.blue * 65535. + 0.5;
-
- g_value_set_boxed (&pcache->value, &rgb);
- }
- }
+ g_value_set_boxed (&pcache->value, &rgba);
else
g_param_value_set_default (pspec, &pcache->value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]