Simplified zoomdiff function

This commit is contained in:
Bert Münnich 2012-08-16 21:21:08 +02:00
parent f2a3d73212
commit c78f55ebb4
2 changed files with 1 additions and 10 deletions

View file

@ -37,13 +37,7 @@ float zoom_min;
float zoom_max; float zoom_max;
int zoomdiff(float z1, float z2) { int zoomdiff(float z1, float z2) {
float d = z1 - z2; return (int) (z1 * 1000.0 - z2 * 1000.0);
const float mindelta = 0.001;
if (ABS(d) < mindelta)
return 0;
else
return d < 0 ? -1 : 1;
} }
void img_init(img_t *img, win_t *win) { void img_init(img_t *img, win_t *win) {

3
util.h
View file

@ -27,9 +27,6 @@
#include "types.h" #include "types.h"
#ifndef ABS
#define ABS(a) ((a) < 0 ? -(a) : (a))
#endif
#ifndef MIN #ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif #endif