Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/thumbs.c
| Context not available. | |||||
| BLI_dir_create_recursive(tpath); | BLI_dir_create_recursive(tpath); | ||||
| } | } | ||||
| } | } | ||||
| /* get thumbnails actual numeric size from enum ThumbSize*/ | |||||
| short thumbsize_numeric_value(ThumbSize size) | |||||
| { | |||||
| short tsize; | |||||
| switch (size) { | |||||
| case THB_NORMAL: | |||||
| tsize = 256; | |||||
| break; | |||||
| case THB_LARGE: | |||||
| tsize = 512; | |||||
| break; | |||||
| case THB_FAIL: | |||||
| tsize = 1; | |||||
| break; | |||||
| default: | |||||
| return 0; /* unknown size */ | |||||
| } | |||||
| return tsize; | |||||
| } | |||||
mont29: This func is not needed imho… But even if we want it, you should:
* return directly value from… | |||||
| /* create thumbnail for file and returns new imbuf for thumbnail */ | /* create thumbnail for file and returns new imbuf for thumbnail */ | ||||
| static ImBuf *thumb_create_ex( | static ImBuf *thumb_create_ex( | ||||
| const char *file_path, const char *uri, const char *thumb, ThumbSize size, ThumbSource source, ImBuf *img) | const char *file_path, const char *uri, const char *thumb, ThumbSize size, ThumbSource source, ImBuf *img) | ||||
| Context not available. | |||||
| float scaledx, scaledy; | float scaledx, scaledy; | ||||
| BLI_stat_t info; | BLI_stat_t info; | ||||
| switch (size) { | tsize = thumbsize_numeric_value(size); | ||||
| case THB_NORMAL: | if (!tsize) { | ||||
| tsize = 128; | return NULL; /* unknown size */ | ||||
| break; | |||||
| case THB_LARGE: | |||||
| tsize = 256; | |||||
| break; | |||||
| case THB_FAIL: | |||||
| tsize = 1; | |||||
| break; | |||||
| default: | |||||
| return NULL; /* unknown size */ | |||||
| } | } | ||||
| /* exception, skip images over 100mb */ | /* exception, skip images over 100mb */ | ||||
| Context not available. | |||||
| img = NULL; | img = NULL; | ||||
| } | } | ||||
| else { | else { | ||||
| /* check if thumbnail is out of date or too small | |||||
| (older versions thumbnails were 128x128)*/ | |||||
| time_t t = atol(mtime); | time_t t = atol(mtime); | ||||
| if (st.st_mtime != t) { | short numeric_size = thumbsize_numeric_value(size); | ||||
| if (st.st_mtime != t || (img->x < numeric_size && img->y < numeric_size)) { | |||||
mont29Unsubmitted Not Done Inline ActionsThis is not needed, thumbnails are temp data by definitions, OS regularily cleans them out anyway. mont29: This is not needed, thumbnails are temp data by definitions, OS regularily cleans them out… | |||||
| /* recreate all thumbs */ | /* recreate all thumbs */ | ||||
| IMB_freeImBuf(img); | IMB_freeImBuf(img); | ||||
| img = NULL; | img = NULL; | ||||
| Context not available. | |||||
This func is not needed imho… But even if we want it, you should: