[gtk/wip/baedert/for-master: 10/29] cssrgbavalue: Add an opaque white singleton
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 10/29] cssrgbavalue: Add an opaque white singleton
- Date: Fri, 23 Aug 2019 07:54:09 +0000 (UTC)
commit 047e31a9a398a90c48b53f6355373c84757a571f
Author: Timm Bäder <mail baedert org>
Date: Fri Aug 23 08:13:20 2019 +0200
cssrgbavalue: Add an opaque white singleton
Used a few hundred times in the widget-factory.
gtk/gtkcssrgbavalue.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/gtk/gtkcssrgbavalue.c b/gtk/gtkcssrgbavalue.c
index f840160bde..ab3d180648 100644
--- a/gtk/gtkcssrgbavalue.c
+++ b/gtk/gtkcssrgbavalue.c
@@ -109,6 +109,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_RGBA = {
static GtkCssValue transparent_black_singleton = (GtkCssValue) { >K_CSS_VALUE_RGBA, 1, { 0, 0, 0, 0 }};
static GtkCssValue transparent_white_singleton = (GtkCssValue) { >K_CSS_VALUE_RGBA, 1, { 1, 1, 1, 0 }};
+static GtkCssValue opaque_white_singleton = (GtkCssValue) { >K_CSS_VALUE_RGBA, 1, { 1, 1, 1, 1 }};
GtkCssValue *
_gtk_css_rgba_value_new_from_rgba (const GdkRGBA *rgba)
@@ -129,6 +130,13 @@ _gtk_css_rgba_value_new_from_rgba (const GdkRGBA *rgba)
rgba->blue == 0)
return _gtk_css_value_ref (&transparent_black_singleton);
}
+ else if (gdk_rgba_is_opaque (rgba))
+ {
+ if (rgba->red == 1 &&
+ rgba->green == 1 &&
+ rgba->blue == 1)
+ return _gtk_css_value_ref (&opaque_white_singleton);
+ }
value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_RGBA);
value->rgba = *rgba;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]