[babl] tools/babl-verify: print selected fast path if a third argument is provided
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] tools/babl-verify: print selected fast path if a third argument is provided
- Date: Thu, 15 Dec 2016 15:42:43 +0000 (UTC)
commit 05403e2dce2bb97e0508cf16247ae646ab18c8bc
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Dec 15 16:40:02 2016 +0100
tools/babl-verify: print selected fast path if a third argument is provided
tools/babl-verify.c | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/tools/babl-verify.c b/tools/babl-verify.c
index 80174db..83b1620 100644
--- a/tools/babl-verify.c
+++ b/tools/babl-verify.c
@@ -1,18 +1,44 @@
#include <stdio.h>
#include <stdlib.h>
-#include "babl/babl.h"
+#include "../config.h"
+#include "babl/babl-internal.h"
int main (int argc, char **argv)
{
- if (argc != 3)
+ int final = 0;
+ const Babl *fish;
+ if (argc < 3)
{
fprintf (stderr, "need two args, from and to babl-formats\n");
return -1;
}
+ if (argc == 4)
+ final = 1;
+
+ if (!final)
+ {
putenv ("BABL_DEBUG_CONVERSIONS" "=" "1");
putenv ("BABL_TOLERANCE" "=" "100000.0");
+ }
+
babl_init ();
- babl_fish (babl_format(argv[1]), babl_format (argv[2]));
+
+ fish = babl_fish (babl_format(argv[1]), babl_format (argv[2]));
+ if (!fish)
+ return -1;
+
+ if (final)
+ switch (fish->class_type)
+ {
+ case BABL_FISH:
+ fprintf (stderr, "%s\n", babl_get_name (fish));
+ break;
+ case BABL_FISH_PATH:
+ fprintf (stderr, "chosen %s to %s: steps: %i error: %f cost: %f\n", argv[1], argv[2],
fish->fish_path.conversion_list->count, fish->fish.error, fish->fish_path.cost);
+ break;
+ }
+
+
babl_exit ();
return 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]