forked from AuroraMiddleware/gtk
css: Don't print numbers with exponent
CSS does not do exponents, so printing numbers close to 0 as 1.234e-15 does not work. Also up the accuracy to 17 digits because that's what everyone else uses.
This commit is contained in:
parent
6e15538328
commit
d71c196c5c
@ -386,7 +386,7 @@ gdk_rgba_to_string (const GdkRGBA *rgba)
|
||||
{
|
||||
gchar alpha[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%g", CLAMP (rgba->alpha, 0, 1));
|
||||
g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%.17f", CLAMP (rgba->alpha, 0, 1));
|
||||
|
||||
return g_strdup_printf ("rgba(%d,%d,%d,%s)",
|
||||
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
||||
|
@ -1510,7 +1510,7 @@ string_append_double (GString *string,
|
||||
{
|
||||
char buf[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%g", d);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%.17f", d);
|
||||
g_string_append (string, buf);
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ gtk_css_token_print (const GtkCssToken *token,
|
||||
/* fall through */
|
||||
case GTK_CSS_TOKEN_SIGNLESS_INTEGER_DIMENSION:
|
||||
case GTK_CSS_TOKEN_DIMENSION:
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, token->dimension.value);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%.17f", token->dimension.value);
|
||||
g_string_append (string, buf);
|
||||
append_ident (string, token->dimension.dimension);
|
||||
break;
|
||||
|
@ -198,7 +198,7 @@ gtk_css_value_dimension_print (const GtkCssValue *number,
|
||||
g_string_append (string, "infinite");
|
||||
else
|
||||
{
|
||||
g_ascii_dtostr (buf, sizeof (buf), number->value);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%.17f", number->value);
|
||||
g_string_append (string, buf);
|
||||
if (number->value != 0.0)
|
||||
g_string_append (string, names[number->unit]);
|
||||
|
Loading…
Reference in New Issue
Block a user