Moved thumbnail sizes array to config.def.h
This commit is contained in:
parent
8fa7247f69
commit
39671a149c
@ -50,6 +50,12 @@ static const bool ANTI_ALIAS = true;
|
|||||||
*/
|
*/
|
||||||
static const bool ALPHA_LAYER = false;
|
static const bool ALPHA_LAYER = false;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#ifdef _THUMBS_CONFIG
|
||||||
|
|
||||||
|
/* thumbnail sizes in pixels (width == height): */
|
||||||
|
static const int thumb_sizes[] = { 32, 64, 96, 128, 160 };
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MAPPINGS_CONFIG
|
#ifdef _MAPPINGS_CONFIG
|
||||||
|
|
||||||
|
14
thumbs.c
14
thumbs.c
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 200112L
|
#define _POSIX_C_SOURCE 200112L
|
||||||
|
#define _THUMBS_CONFIG
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -36,7 +37,6 @@ void exif_auto_orientate(const fileinfo_t*);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *cache_dir;
|
static char *cache_dir;
|
||||||
static const int thumb_size[] = { 32, 64, 96, 128, 160 };
|
|
||||||
|
|
||||||
char* tns_cache_filepath(const char *filepath)
|
char* tns_cache_filepath(const char *filepath)
|
||||||
{
|
{
|
||||||
@ -330,11 +330,11 @@ bool tns_load(tns_t *tns, int n, bool force)
|
|||||||
imlib_context_set_image(im);
|
imlib_context_set_image(im);
|
||||||
exif_auto_orientate(file);
|
exif_auto_orientate(file);
|
||||||
#endif
|
#endif
|
||||||
im = tns_scale_down(im, thumb_size[ARRLEN(thumb_size)-1]);
|
im = tns_scale_down(im, thumb_sizes[ARRLEN(thumb_sizes)-1]);
|
||||||
tns_cache_write(im, file->path, true);
|
tns_cache_write(im, file->path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
t->im = tns_scale_down(im, thumb_size[tns->zl]);
|
t->im = tns_scale_down(im, thumb_sizes[tns->zl]);
|
||||||
imlib_context_set_image(t->im);
|
imlib_context_set_image(t->im);
|
||||||
t->w = imlib_image_get_width();
|
t->w = imlib_image_get_width();
|
||||||
t->h = imlib_image_get_height();
|
t->h = imlib_image_get_height();
|
||||||
@ -434,8 +434,8 @@ void tns_render(tns_t *tns)
|
|||||||
for (i = tns->first; i < tns->end; i++) {
|
for (i = tns->first; i < tns->end; i++) {
|
||||||
t = &tns->thumbs[i];
|
t = &tns->thumbs[i];
|
||||||
if (t->im != NULL) {
|
if (t->im != NULL) {
|
||||||
t->x = x + (thumb_size[tns->zl] - t->w) / 2;
|
t->x = x + (thumb_sizes[tns->zl] - t->w) / 2;
|
||||||
t->y = y + (thumb_size[tns->zl] - t->h) / 2;
|
t->y = y + (thumb_sizes[tns->zl] - t->h) / 2;
|
||||||
imlib_context_set_image(t->im);
|
imlib_context_set_image(t->im);
|
||||||
imlib_render_image_on_drawable_at_size(t->x, t->y, t->w, t->h);
|
imlib_render_image_on_drawable_at_size(t->x, t->y, t->w, t->h);
|
||||||
if (tns->files[i].marked)
|
if (tns->files[i].marked)
|
||||||
@ -572,9 +572,9 @@ bool tns_zoom(tns_t *tns, int d)
|
|||||||
oldzl = tns->zl;
|
oldzl = tns->zl;
|
||||||
tns->zl += -(d < 0) + (d > 0);
|
tns->zl += -(d < 0) + (d > 0);
|
||||||
tns->zl = MAX(tns->zl, 0);
|
tns->zl = MAX(tns->zl, 0);
|
||||||
tns->zl = MIN(tns->zl, ARRLEN(thumb_size)-1);
|
tns->zl = MIN(tns->zl, ARRLEN(thumb_sizes)-1);
|
||||||
|
|
||||||
tns->dim = thumb_size[tns->zl] + 10;
|
tns->dim = thumb_sizes[tns->zl] + 10;
|
||||||
|
|
||||||
if (tns->zl != oldzl) {
|
if (tns->zl != oldzl) {
|
||||||
for (i = 0; i < tns->cnt; i++)
|
for (i = 0; i < tns->cnt; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user