[gtk+] gdkrgba: Use %g instead of %.17g to print alpha
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdkrgba: Use %g instead of %.17g to print alpha
- Date: Mon, 2 Nov 2015 19:32:25 +0000 (UTC)
commit 96a485d8b22e7ac2bc155350b8d084fd0e0f6292
Author: Benjamin Otte <otte redhat com>
Date: Mon Nov 2 17:04:39 2015 +0100
gdkrgba: Use %g instead of %.17g to print alpha
This way 0.3 isn't printed as 0.29999999999999
gdk/gdkrgba.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gdk/gdkrgba.c b/gdk/gdkrgba.c
index 43195dd..2a8e096 100644
--- a/gdk/gdkrgba.c
+++ b/gdk/gdkrgba.c
@@ -366,7 +366,7 @@ gdk_rgba_to_string (const GdkRGBA *rgba)
{
gchar alpha[G_ASCII_DTOSTR_BUF_SIZE];
- g_ascii_dtostr (alpha, G_ASCII_DTOSTR_BUF_SIZE, CLAMP (rgba->alpha, 0, 1));
+ g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%g", CLAMP (rgba->alpha, 0, 1));
return g_strdup_printf ("rgba(%d,%d,%d,%s)",
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]