summaryrefslogtreecommitdiff
path: root/tools/babl-gen-test-pixels.c
diff options
context:
space:
mode:
authorEll <ell_se@yahoo.com>2017-06-08 09:09:42 -0400
committerEll <ell_se@yahoo.com>2017-06-08 13:57:36 -0400
commit5a97284e2ce61c02ee870e53ab64f137295d1173 (patch)
tree7a76f4633fee4ee57a265831da09296b9a346c32 /tools/babl-gen-test-pixels.c
parentc8b5eee3f86a49bd093929f0bd16ef780de88c67 (diff)
babl-gen-test-pixels: update floating-point format of output ...
... to match commit 37947d19cd217ef5a04da46627a60ccde8925122.
Diffstat (limited to 'tools/babl-gen-test-pixels.c')
-rw-r--r--tools/babl-gen-test-pixels.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/tools/babl-gen-test-pixels.c b/tools/babl-gen-test-pixels.c
index 54c1b16..6dbd3cc 100644
--- a/tools/babl-gen-test-pixels.c
+++ b/tools/babl-gen-test-pixels.c
@@ -26,6 +26,12 @@
#define BABL_MODEL_NUM_TEST_PIXELS 512
#define BABL_TYPE_NUM_TEST_PIXELS 512
+#define BABL_COMPONENT_FMT_STR "%.13f"
+#define BABL_PIXEL_FMT_STR BABL_COMPONENT_FMT_STR ", " \
+ BABL_COMPONENT_FMT_STR ", " \
+ BABL_COMPONENT_FMT_STR ", " \
+ BABL_COMPONENT_FMT_STR
+
static double rand_double (void)
{
return (double) random () / RAND_MAX;
@@ -45,10 +51,10 @@ static void gen_path_pixels (void)
printf ("static const double babl_path_test_pixels[%d] = {\n", BABL_PATH_NUM_TEST_PIXELS * 4);
- /* add 128 pixels in the valid range between 0.0 and 1.0 */
+ /* add 256 pixels in the valid range between 0.0 and 1.0 */
for (i = 0; i < 256; i++)
{
- printf ("%a, %a, %a, %a,\n",
+ printf (BABL_PIXEL_FMT_STR ",\n",
rand_double (),
rand_double (),
rand_double (),
@@ -58,7 +64,7 @@ static void gen_path_pixels (void)
/* add 16 pixels between -1.0 and 0.0 */
for (i = 0; i < 16; i++)
{
- printf ("%a, %a, %a, %a,\n",
+ printf (BABL_PIXEL_FMT_STR ",\n",
rand_range_double (-1.0, 0.0),
rand_range_double (-1.0, 0.0),
rand_range_double (-1.0, 0.0),
@@ -68,7 +74,7 @@ static void gen_path_pixels (void)
/* add 16 pixels between 1.0 and 2.0 */
for (i = 0; i < 16; i++)
{
- printf ("%a, %a, %a, %a,\n",
+ printf (BABL_PIXEL_FMT_STR ",\n",
rand_range_double (1.0, 2.0),
rand_range_double (1.0, 2.0),
rand_range_double (1.0, 2.0),
@@ -77,7 +83,7 @@ static void gen_path_pixels (void)
for (i = 288; i < BABL_PATH_NUM_TEST_PIXELS; i++)
{
- printf ("%a, %a, %a, %a,\n",
+ printf (BABL_PIXEL_FMT_STR ",\n",
rand_double (),
rand_double (),
rand_double (),
@@ -107,7 +113,7 @@ static void gen_model_pixels (void)
/* add 128 pixels in the valid range between 0.0 and 1.0 */
for (i = 0; i < BABL_MODEL_NUM_TEST_PIXELS; i++)
{
- printf ("%a, %a, %a, %a,\n",
+ printf (BABL_PIXEL_FMT_STR ",\n",
rand_range_double (-0.2, 1.2),
rand_range_double (-0.2, 1.2),
rand_range_double (-0.2, 1.2),
@@ -129,7 +135,7 @@ static void gen_type_pixels (void)
/* add 128 pixels in the valid range between 0.0 and 1.0 */
for (i = 0; i < BABL_MODEL_NUM_TEST_PIXELS; i++)
{
- printf ("%a, %a, %a, %a,\n",
+ printf (BABL_PIXEL_FMT_STR ",\n",
rand_range_double (0.0, 128.0),
rand_range_double (0.0, 128.0),
rand_range_double (0.0, 128.0),