From 22e16d2ba6136fee9e6827f5fe9f10fe49eae5a7 Mon Sep 17 00:00:00 2001 From: tonton Th Date: Mon, 6 Apr 2020 20:09:11 +0200 Subject: [PATCH] renaming a function for clarity --- doc/the_floatimg_hack.tex | 7 +++++-- floatimg.h | 2 +- lib/fimg-compare.c | 2 +- lib/fimg-core.c | 2 +- lib/interpolate.c | 4 ++-- tools/fimgops.c | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/the_floatimg_hack.tex b/doc/the_floatimg_hack.tex index 63a12c7..1b47989 100644 --- a/doc/the_floatimg_hack.tex +++ b/doc/the_floatimg_hack.tex @@ -10,7 +10,7 @@ % \lstset{frame=single} % dessin d'un cadre autour du listing \lstset{basicstyle=\ttfamily\small} -\lstset{aboveskip=0.333em,belowskip=0.666em} +\lstset{aboveskip=0.222em,belowskip=0.222em} \usepackage{babel} @@ -355,9 +355,12 @@ classiques : gray, rgb et rgba. et expliquées quelques lignes plus haut. Comme vous allez le voir plus loin, il y a plein de fonctions qui prennent en argument deux images: une source et une destination. +Et dans la plupart des cas, ces deux images doivent être compatibles, +c'est à dire même type et mêmes dimensions. \begin{lstlisting} -int fimg_images_compatible(FloatImg *a, FloatImg *b); +/* return 0 if compatible */ +int fimg_images_not_compatible(FloatImg *a, FloatImg *b); \end{lstlisting} diff --git a/floatimg.h b/floatimg.h index b6bdfda..5732591 100644 --- a/floatimg.h +++ b/floatimg.h @@ -68,7 +68,7 @@ int fimg_add_rgb(FloatImg *head, int x, int y, float r, float g, float b); int fimg_rgb_constant(FloatImg *head, float r, float g, float b); /* --> lib/fimg-compare.c */ -int fimg_images_compatible(FloatImg *a, FloatImg *b); +int fimg_images_not_compatible(FloatImg *a, FloatImg *b); int fimg_interpolate(FloatImg *s1, FloatImg *s2, FloatImg *d, float coef); diff --git a/lib/fimg-compare.c b/lib/fimg-compare.c index 8576e38..c0b6a72 100644 --- a/lib/fimg-compare.c +++ b/lib/fimg-compare.c @@ -16,7 +16,7 @@ extern int verbosity; /* must be declared around main() */ /* * return 0 if images are compatibles */ -int fimg_images_compatible(FloatImg *a, FloatImg *b) +int fimg_images_not_compatible(FloatImg *a, FloatImg *b) { #if DEBUG_LEVEL > 1 fprintf(stderr, ">>> %s ( %p %p )\n", __func__, a, b); diff --git a/lib/fimg-core.c b/lib/fimg-core.c index 3896ced..430837c 100644 --- a/lib/fimg-core.c +++ b/lib/fimg-core.c @@ -194,7 +194,7 @@ int foo; fprintf(stderr, ">>> %-25s ( %p %p )\n", __func__, from, to); #endif -foo = fimg_images_compatible(from, to); +foo = fimg_images_not_compatible(from, to); if (foo) { fprintf(stderr, "%s: pics not compatible (%d)\n", __func__, foo); return foo; diff --git a/lib/interpolate.c b/lib/interpolate.c index 737c48b..b64f111 100644 --- a/lib/interpolate.c +++ b/lib/interpolate.c @@ -46,13 +46,13 @@ fprintf(stderr, ">>> %s ( %p %p %p %f )\n", __func__, s1, s2, d, coef); #endif -foo = fimg_images_compatible(s1, s2); +foo = fimg_images_not_compatible(s1, s2); if (foo) { fprintf(stderr, "compat s1 s2 -> %d\n", foo); return foo; } -foo = fimg_images_compatible(s1, d); +foo = fimg_images_not_compatible(s1, d); if (foo) { fprintf(stderr, "compat s1 d -> %d\n", foo); return foo; diff --git a/tools/fimgops.c b/tools/fimgops.c index 02f17bf..91bc9b2 100644 --- a/tools/fimgops.c +++ b/tools/fimgops.c @@ -153,7 +153,7 @@ if (verbosity > 1) { /* please, debug me */ fimg_describe(&srcB, argv[optind+1]); } -foo = fimg_images_compatible(&srcA, &srcB); +foo = fimg_images_not_compatible(&srcA, &srcB); if (foo) { fprintf(stderr, "images are not compatibles, %d\n", foo); exit(4);