diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-08 03:10:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-08 03:38:19 +0300 |
commit | 8c539b0ab521d442d88c70243c04cbb9e40fe412 (patch) | |
tree | 58b1ffb19b1117404698a6705a87406722400b01 /source/blender/imbuf/intern/thumbs.c | |
parent | c56c493cf403b63ec46b90023cdc8137275a310f (diff) |
Font preview for file browser
D1002 by @plasmasolutions, with own refactoring.
Note, needed to do a bad-level call here (IMB -> BLF)
Also can't use the BLF API directly because its not thread-safe.
So keep the function isolated (blf_thumbs.c).
Diffstat (limited to 'source/blender/imbuf/intern/thumbs.c')
-rw-r--r-- | source/blender/imbuf/intern/thumbs.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index e88cbef206a..78f47b7bc34 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -330,15 +330,22 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im if (!img) return NULL; } else { - if (THB_SOURCE_IMAGE == source || THB_SOURCE_BLEND == source) { + if (ELEM(source, THB_SOURCE_IMAGE, THB_SOURCE_BLEND, THB_SOURCE_FONT)) { /* only load if we didnt give an image */ if (img == NULL) { - if (THB_SOURCE_BLEND == source) { - img = IMB_thumb_load_blend(path); - } - else { - img = IMB_loadiffname(path, IB_rect | IB_metadata | IB_thumbnail, NULL); + switch (source) { + case THB_SOURCE_IMAGE: + img = IMB_loadiffname(path, IB_rect | IB_metadata, NULL); + break; + case THB_SOURCE_BLEND: + img = IMB_thumb_load_blend(path); + break; + case THB_SOURCE_FONT: + img = IMB_thumb_load_font(path, tsize, tsize); + break; + default: + BLI_assert(0); /* This should never happen */ } } |