nsxiv39671a1
Moved thumbnail sizes array to config.def.h
+13 −7
2 files changed
- M config.def.h +6 −0
- M thumbs.c +7 −7
| @@ -50,6 +50,12 @@ static const bool ANTI_ALIAS = true; | |||
| 50 | 50 | */ | |
| 51 | 51 | static const bool ALPHA_LAYER = false; | |
| 52 | 52 | ||
| 53 | + | #endif | |
| 54 | + | #ifdef _THUMBS_CONFIG | |
| 55 | + | ||
| 56 | + | /* thumbnail sizes in pixels (width == height): */ | |
| 57 | + | static const int thumb_sizes[] = { 32, 64, 96, 128, 160 }; | |
| 58 | + | ||
| 53 | 59 | #endif | |
| 54 | 60 | #ifdef _MAPPINGS_CONFIG | |
| 55 | 61 | ||
| @@ -17,6 +17,7 @@ | |||
| 17 | 17 | */ | |
| 18 | 18 | ||
| 19 | 19 | #define _POSIX_C_SOURCE 200112L | |
| 20 | + | #define _THUMBS_CONFIG | |
| 20 | 21 | ||
| 21 | 22 | #include <stdio.h> | |
| 22 | 23 | #include <stdlib.h> | |
| @@ -36,7 +37,6 @@ void exif_auto_orientate(const fileinfo_t*); | |||
| 36 | 37 | #endif | |
| 37 | 38 | ||
| 38 | 39 | static char *cache_dir; | |
| 39 | − | static const int thumb_size[] = { 32, 64, 96, 128, 160 }; | |
| 40 | 40 | ||
| 41 | 41 | char* tns_cache_filepath(const char *filepath) | |
| 42 | 42 | { | |
| @@ -330,11 +330,11 @@ bool tns_load(tns_t *tns, int n, bool force) | |||
| 330 | 330 | imlib_context_set_image(im); | |
| 331 | 331 | exif_auto_orientate(file); | |
| 332 | 332 | #endif | |
| 333 | − | im = tns_scale_down(im, thumb_size[ARRLEN(thumb_size)-1]); | |
| 333 | + | im = tns_scale_down(im, thumb_sizes[ARRLEN(thumb_sizes)-1]); | |
| 334 | 334 | tns_cache_write(im, file->path, true); | |
| 335 | 335 | } | |
| 336 | 336 | ||
| 337 | − | t->im = tns_scale_down(im, thumb_size[tns->zl]); | |
| 337 | + | t->im = tns_scale_down(im, thumb_sizes[tns->zl]); | |
| 338 | 338 | imlib_context_set_image(t->im); | |
| 339 | 339 | t->w = imlib_image_get_width(); | |
| 340 | 340 | t->h = imlib_image_get_height(); | |
| @@ -434,8 +434,8 @@ void tns_render(tns_t *tns) | |||
| 434 | 434 | for (i = tns->first; i < tns->end; i++) { | |
| 435 | 435 | t = &tns->thumbs[i]; | |
| 436 | 436 | if (t->im != NULL) { | |
| 437 | − | t->x = x + (thumb_size[tns->zl] - t->w) / 2; | |
| 438 | − | t->y = y + (thumb_size[tns->zl] - t->h) / 2; | |
| 437 | + | t->x = x + (thumb_sizes[tns->zl] - t->w) / 2; | |
| 438 | + | t->y = y + (thumb_sizes[tns->zl] - t->h) / 2; | |
| 439 | 439 | imlib_context_set_image(t->im); | |
| 440 | 440 | imlib_render_image_on_drawable_at_size(t->x, t->y, t->w, t->h); | |
| 441 | 441 | if (tns->files[i].marked) | |
| @@ -572,9 +572,9 @@ bool tns_zoom(tns_t *tns, int d) | |||
| 572 | 572 | oldzl = tns->zl; | |
| 573 | 573 | tns->zl += -(d < 0) + (d > 0); | |
| 574 | 574 | tns->zl = MAX(tns->zl, 0); | |
| 575 | − | tns->zl = MIN(tns->zl, ARRLEN(thumb_size)-1); | |
| 575 | + | tns->zl = MIN(tns->zl, ARRLEN(thumb_sizes)-1); | |
| 576 | 576 | ||
| 577 | − | tns->dim = thumb_size[tns->zl] + 10; | |
| 577 | + | tns->dim = thumb_sizes[tns->zl] + 10; | |
| 578 | 578 | ||
| 579 | 579 | if (tns->zl != oldzl) { | |
| 580 | 580 | for (i = 0; i < tns->cnt; i++) | |