[gtk/matthiasc/css-values: 3/12] Add opaque black singleton



commit 4685d25bde8f7072e3b69e3f7507361b5dcad5c7
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 9 23:18:43 2020 -0500

    Add opaque black singleton

 gtk/gtkcssrgbavalue.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gtk/gtkcssrgbavalue.c b/gtk/gtkcssrgbavalue.c
index dad1f3ee39..a45709ad8f 100644
--- a/gtk/gtkcssrgbavalue.c
+++ b/gtk/gtkcssrgbavalue.c
@@ -110,6 +110,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_RGBA = {
 
 static GtkCssValue transparent_black_singleton = { &GTK_CSS_VALUE_RGBA, 1, { 0, 0, 0, 0 }};
 static GtkCssValue transparent_white_singleton = { &GTK_CSS_VALUE_RGBA, 1, { 1, 1, 1, 0 }};
+static GtkCssValue opaque_black_singleton      = { &GTK_CSS_VALUE_RGBA, 1, { 0, 0, 0, 1 }};
 static GtkCssValue opaque_white_singleton      = { &GTK_CSS_VALUE_RGBA, 1, { 1, 1, 1, 1 }};
 
 GtkCssValue *
@@ -137,6 +138,11 @@ _gtk_css_rgba_value_new_from_rgba (const GdkRGBA *rgba)
           rgba->green == 1 &&
           rgba->blue == 1)
         return _gtk_css_value_ref (&opaque_white_singleton);
+
+      if (rgba->red == 0 &&
+          rgba->green == 0 &&
+          rgba->blue == 0)
+        return _gtk_css_value_ref (&opaque_black_singleton);
     }
 
   value = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_RGBA);


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