Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/filelist.c
| Show First 20 Lines • Show All 1,323 Lines • ▼ Show 20 Lines | static void filelist_cache_preview_freef(TaskPool *__restrict UNUSED(pool), | ||||
| MEM_freeN(preview_taskdata); | MEM_freeN(preview_taskdata); | ||||
| } | } | ||||
| static void filelist_cache_preview_ensure_running(FileListEntryCache *cache) | static void filelist_cache_preview_ensure_running(FileListEntryCache *cache) | ||||
| { | { | ||||
| if (!cache->previews_pool) { | if (!cache->previews_pool) { | ||||
| TaskScheduler *scheduler = BLI_task_scheduler_get(); | TaskScheduler *scheduler = BLI_task_scheduler_get(); | ||||
| cache->previews_pool = BLI_task_pool_create_background(scheduler, cache); | cache->previews_pool = BLI_task_pool_create_background(scheduler, cache, TASK_PRIORITY_LOW); | ||||
| cache->previews_done = BLI_thread_queue_init(); | cache->previews_done = BLI_thread_queue_init(); | ||||
| IMB_thumb_locks_acquire(); | IMB_thumb_locks_acquire(); | ||||
| } | } | ||||
| } | } | ||||
| static void filelist_cache_previews_clear(FileListEntryCache *cache) | static void filelist_cache_previews_clear(FileListEntryCache *cache) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | if (!entry->image && !(entry->flags & FILE_ENTRY_INVALID_PREVIEW) && | ||||
| preview->img = NULL; | preview->img = NULL; | ||||
| // printf("%s: %d - %s - %p\n", __func__, preview->index, preview->path, preview->img); | // printf("%s: %d - %s - %p\n", __func__, preview->index, preview->path, preview->img); | ||||
| filelist_cache_preview_ensure_running(cache); | filelist_cache_preview_ensure_running(cache); | ||||
| FileListEntryPreviewTaskData *preview_taskdata = MEM_mallocN(sizeof(*preview_taskdata), | FileListEntryPreviewTaskData *preview_taskdata = MEM_mallocN(sizeof(*preview_taskdata), | ||||
| __func__); | __func__); | ||||
| preview_taskdata->preview = preview; | preview_taskdata->preview = preview; | ||||
| BLI_task_pool_push_ex(cache->previews_pool, | BLI_task_pool_push(cache->previews_pool, | ||||
| filelist_cache_preview_runf, | filelist_cache_preview_runf, | ||||
| preview_taskdata, | preview_taskdata, | ||||
| true, | true, | ||||
| filelist_cache_preview_freef, | filelist_cache_preview_freef); | ||||
| TASK_PRIORITY_LOW); | |||||
| } | } | ||||
| } | } | ||||
| static void filelist_cache_init(FileListEntryCache *cache, size_t cache_size) | static void filelist_cache_init(FileListEntryCache *cache, size_t cache_size) | ||||
| { | { | ||||
| BLI_listbase_clear(&cache->cached_entries); | BLI_listbase_clear(&cache->cached_entries); | ||||
| cache->block_cursor = cache->block_start_index = cache->block_center_index = | cache->block_cursor = cache->block_start_index = cache->block_center_index = | ||||
| ▲ Show 20 Lines • Show All 1,689 Lines • Show Last 20 Lines | |||||