From c78f55ebb43f5d73033a4709dfd32830a016a7cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Thu, 16 Aug 2012 21:21:08 +0200 Subject: [PATCH] Simplified zoomdiff function --- image.c | 8 +------- util.h | 3 --- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/image.c b/image.c index 52696ca..cf4ec35 100644 --- a/image.c +++ b/image.c @@ -37,13 +37,7 @@ float zoom_min; float zoom_max; int zoomdiff(float z1, float z2) { - float d = z1 - z2; - const float mindelta = 0.001; - - if (ABS(d) < mindelta) - return 0; - else - return d < 0 ? -1 : 1; + return (int) (z1 * 1000.0 - z2 * 1000.0); } void img_init(img_t *img, win_t *win) { diff --git a/util.h b/util.h index 2a139ec..f1f4f14 100644 --- a/util.h +++ b/util.h @@ -27,9 +27,6 @@ #include "types.h" -#ifndef ABS -#define ABS(a) ((a) < 0 ? -(a) : (a)) -#endif #ifndef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif