forked from AuroraMiddleware/gtk
cssdimenstionvalue: Add common degree value singletons
This commit is contained in:
parent
fb0b0ddfe0
commit
cd3cd64769
@ -318,6 +318,12 @@ gtk_css_dimension_value_new (double value,
|
||||
{ >K_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_S, 0 },
|
||||
{ >K_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_S, 1 },
|
||||
};
|
||||
static GtkCssValue deg_singletons[] = {
|
||||
{ >K_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_DEG, 0 },
|
||||
{ >K_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_DEG, 90 },
|
||||
{ >K_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_DEG, 180 },
|
||||
{ >K_CSS_VALUE_DIMENSION.value_class, 1, GTK_CSS_DEG, 270 },
|
||||
};
|
||||
GtkCssValue *result;
|
||||
|
||||
switch ((guint)unit)
|
||||
@ -365,6 +371,18 @@ gtk_css_dimension_value_new (double value,
|
||||
|
||||
break;
|
||||
|
||||
case GTK_CSS_DEG:
|
||||
if (value == 0)
|
||||
return _gtk_css_value_ref (°_singletons[0]);
|
||||
if (value == 90)
|
||||
return _gtk_css_value_ref (°_singletons[1]);
|
||||
if (value == 180)
|
||||
return _gtk_css_value_ref (°_singletons[2]);
|
||||
if (value == 270)
|
||||
return _gtk_css_value_ref (°_singletons[3]);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user