Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_image_proj.c
| Show First 20 Lines • Show All 5,611 Lines • ▼ Show 20 Lines | static bool project_paint_op(void *state, const float lastpos[2], const float pos[2]) | ||||
| struct ImagePool *image_pool; | struct ImagePool *image_pool; | ||||
| if (!project_bucket_iter_init(ps, pos)) { | if (!project_bucket_iter_init(ps, pos)) { | ||||
| return touch_any; | return touch_any; | ||||
| } | } | ||||
| if (ps->thread_tot > 1) { | if (ps->thread_tot > 1) { | ||||
| scheduler = BLI_task_scheduler_get(); | scheduler = BLI_task_scheduler_get(); | ||||
| task_pool = BLI_task_pool_create_suspended(scheduler, NULL); | task_pool = BLI_task_pool_create_suspended(scheduler, NULL, TASK_PRIORITY_HIGH); | ||||
| } | } | ||||
| image_pool = BKE_image_pool_new(); | image_pool = BKE_image_pool_new(); | ||||
| /* get the threads running */ | /* get the threads running */ | ||||
| for (a = 0; a < ps->thread_tot; a++) { | for (a = 0; a < ps->thread_tot; a++) { | ||||
| /* set defaults in handles */ | /* set defaults in handles */ | ||||
| Show All 18 Lines | for (i = 0; i < ps->image_tot; i++) { | ||||
| memcpy(handles[a].projImages[i].partRedrawRect, | memcpy(handles[a].projImages[i].partRedrawRect, | ||||
| ps->projImages[i].partRedrawRect, | ps->projImages[i].partRedrawRect, | ||||
| sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED); | sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED); | ||||
| } | } | ||||
| handles[a].pool = image_pool; | handles[a].pool = image_pool; | ||||
| if (task_pool != NULL) { | if (task_pool != NULL) { | ||||
| BLI_task_pool_push( | BLI_task_pool_push(task_pool, do_projectpaint_thread, &handles[a], false, NULL); | ||||
| task_pool, do_projectpaint_thread, &handles[a], false, TASK_PRIORITY_HIGH); | |||||
| } | } | ||||
| } | } | ||||
| if (task_pool != NULL) { /* wait for everything to be done */ | if (task_pool != NULL) { /* wait for everything to be done */ | ||||
| BLI_task_pool_work_and_wait(task_pool); | BLI_task_pool_work_and_wait(task_pool); | ||||
| BLI_task_pool_free(task_pool); | BLI_task_pool_free(task_pool); | ||||
| } | } | ||||
| else { | else { | ||||
| ▲ Show 20 Lines • Show All 1,159 Lines • Show Last 20 Lines | |||||