nsxivc78f55e
Simplified zoomdiff function
+1 −10
2 files changed
| @@ -37,13 +37,7 @@ float zoom_min; | |||
| 37 | 37 | float zoom_max; | |
| 38 | 38 | ||
| 39 | 39 | int zoomdiff(float z1, float z2) { | |
| 40 | − | float d = z1 - z2; | |
| 41 | − | const float mindelta = 0.001; | |
| 42 | − | ||
| 43 | − | if (ABS(d) < mindelta) | |
| 44 | − | return 0; | |
| 45 | − | else | |
| 46 | − | return d < 0 ? -1 : 1; | |
| 40 | + | return (int) (z1 * 1000.0 - z2 * 1000.0); | |
| 47 | 41 | } | |
| 48 | 42 | ||
| 49 | 43 | void img_init(img_t *img, win_t *win) { | |
| @@ -27,9 +27,6 @@ | |||
| 27 | 27 | ||
| 28 | 28 | #include "types.h" | |
| 29 | 29 | ||
| 30 | − | #ifndef ABS | |
| 31 | − | #define ABS(a) ((a) < 0 ? -(a) : (a)) | |
| 32 | − | #endif | |
| 33 | 30 | #ifndef MIN | |
| 34 | 31 | #define MIN(a,b) ((a) < (b) ? (a) : (b)) | |
| 35 | 32 | #endif | |