92 #define USE_SCANFILL_EDGE_WORKAROUND
94 #define SPLINE_RESOL_CAP_PER_PIXEL 2
95 #define SPLINE_RESOL_CAP_MIN 8
96 #define SPLINE_RESOL_CAP_MAX 64
99 #define BUCKET_PIXELS_PER_CELL 4
101 #define SF_EDGE_IS_BOUNDARY 0xff
102 #define SF_KEYINDEX_TEMP_ID ((unsigned int)-1)
104 #define TRI_TERMINATOR_ID ((unsigned int)-1)
105 #define TRI_VERT ((unsigned int)-1)
110 # define FACE_ASSERT(face, vert_max) \
112 unsigned int *_t = face; \
113 BLI_assert(_t[0] < vert_max); \
114 BLI_assert(_t[1] < vert_max); \
115 BLI_assert(_t[2] < vert_max); \
116 BLI_assert(_t[3] < vert_max || _t[3] == TRI_VERT); \
121 # define FACE_ASSERT(face, vert_max)
127 float r_p[2],
const float p[2],
const float cent[2],
const float angle,
const float asp[2])
134 r_p[0] = (p[0] - cent[0]) / asp[0];
135 r_p[1] = (p[1] - cent[1]) / asp[1];
138 p_new[0] = ((r_p[0] *
c) - (r_p[1] * s)) * asp[0];
139 p_new[1] = ((r_p[0] * s) + (r_p[1] *
c)) * asp[1];
142 r_p[0] = p_new[0] + cent[0];
143 r_p[1] = p_new[1] + cent[1];
147 const unsigned int min,
148 const unsigned int max)
228 const unsigned int layers_tot = mr_handle->
layers_tot;
231 for (
uint i = 0; i < layers_tot; i++, layer++) {
243 unsigned int bucket_index;
244 for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) {
245 unsigned int *face_index = layer->
buckets_face[bucket_index];
260 float (*diff_points)[2],
261 const unsigned int tot_diff_point,
265 unsigned int k_prev = tot_diff_point - 2;
266 unsigned int k_curr = tot_diff_point - 1;
267 unsigned int k_next = 0;
275 const float *co_prev;
276 const float *co_curr;
277 const float *co_next;
279 const float ofs_squared = ofs * ofs;
281 co_prev = diff_points[k_prev];
282 co_curr = diff_points[k_curr];
283 co_next = diff_points[k_next];
289 for (k = 0; k < tot_diff_point; k++) {
292 co_curr = diff_points[k_curr];
293 co_next = diff_points[k_next];
301 if ((do_test ==
false) ||
308 diff_feather_points[k][0] = diff_points[k][0] + (d[1] * ofs);
309 diff_feather_points[k][1] = diff_points[k][1] + (-d[0] * ofs);
331 unsigned int face_index,
332 const unsigned int bucket_x,
333 const unsigned int bucket_y,
334 const float bucket_size_x,
335 const float bucket_size_y,
336 const float bucket_max_rad_squared)
338 unsigned int *face = layer->
face_array[face_index];
341 const float xmin = layer->
bounds.
xmin + (bucket_size_x * (
float)bucket_x);
342 const float ymin = layer->
bounds.
ymin + (bucket_size_y * (
float)bucket_y);
343 const float xmax = xmin + bucket_size_x;
344 const float ymax = ymin + bucket_size_y;
346 const float cent[2] = {(xmin + xmax) * 0.5f, (ymin + ymax) * 0.5f};
349 const float *
v1 =
cos[face[0]];
350 const float *
v2 =
cos[face[1]];
351 const float *v3 =
cos[face[2]];
367 const float *
v1 =
cos[face[0]];
368 const float *
v2 =
cos[face[1]];
369 const float *v3 =
cos[face[2]];
370 const float *v4 =
cos[face[3]];
427 const float bucket_size_x = (bucket_dim_x + FLT_EPSILON) / (
float)layer->
buckets_x;
428 const float bucket_size_y = (bucket_dim_y + FLT_EPSILON) / (
float)layer->
buckets_y;
429 const float bucket_max_rad = (
max_ff(bucket_size_x, bucket_size_y) * (
float)
M_SQRT2) +
431 const float bucket_max_rad_squared = bucket_max_rad * bucket_max_rad;
433 unsigned int *face = &layer->
face_array[0][0];
438 unsigned int *bucketstore_tot =
MEM_callocN(bucket_tot *
sizeof(
unsigned int), __func__);
440 unsigned int face_index;
442 for (face_index = 0; face_index < layer->
face_tot; face_index++, face += 4) {
449 const float *
v1 =
cos[face[0]];
450 const float *
v2 =
cos[face[1]];
451 const float *v3 =
cos[face[2]];
459 const float *
v1 =
cos[face[0]];
460 const float *
v2 =
cos[face[1]];
461 const float *v3 =
cos[face[2]];
462 const float *v4 =
cos[face[3]];
471 if (!((xmax < 0.0f) || (ymax < 0.0f) || (xmin > 1.0f) || (ymin > 1.0f))) {
473 CLAMP(xmin, 0.0f, 1.0f);
474 CLAMP(ymin, 0.0f, 1.0f);
475 CLAMP(xmax, 0.0f, 1.0f);
476 CLAMP(ymax, 0.0f, 1.0f);
479 unsigned int xi_min = (
unsigned int)((xmin - layer->
bounds.
xmin) *
481 unsigned int xi_max = (
unsigned int)((xmax - layer->
bounds.
xmin) *
483 unsigned int yi_min = (
unsigned int)((ymin - layer->
bounds.
ymin) *
485 unsigned int yi_max = (
unsigned int)((ymax - layer->
bounds.
ymin) *
506 for (yi = yi_min; yi <= yi_max; yi++) {
507 unsigned int bucket_index = (layer->
buckets_x * yi) + xi_min;
508 for (xi = xi_min; xi <= xi_max; xi++, bucket_index++) {
527 bucket_max_rad_squared)) {
529 bucketstore_tot[bucket_index]++;
539 unsigned int **buckets_face =
MEM_mallocN(bucket_tot *
sizeof(*buckets_face), __func__);
540 unsigned int bucket_index;
542 for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) {
543 if (bucketstore_tot[bucket_index]) {
545 (bucketstore_tot[bucket_index] + 1) *
sizeof(
unsigned int), __func__);
548 buckets_face[bucket_index] = bucket;
550 for (bucket_node = bucketstore[bucket_index]; bucket_node;
551 bucket_node = bucket_node->
next) {
558 buckets_face[bucket_index] =
NULL;
576 const bool do_aspect_correct,
577 const bool do_mask_aa,
578 const bool do_feather)
580 const rctf default_bounds = {0.0f, 1.0f, 0.0f, 1.0f};
582 const float asp_xy[2] = {
586 const float zvec[3] = {0.0f, 0.0f, -1.0f};
588 unsigned int masklay_index;
598 for (masklay =
mask->masklayers.first, masklay_index = 0; masklay;
599 masklay = masklay->
next, masklay_index++) {
602 unsigned int tot_splines;
604 unsigned int open_spline_index = 0;
614 unsigned int sf_vert_tot = 0;
615 unsigned int tot_feather_quads = 0;
617 #ifdef USE_SCANFILL_EDGE_WORKAROUND
618 unsigned int tot_boundary_used = 0;
619 unsigned int tot_boundary_found = 0;
630 open_spline_ranges =
MEM_callocN(
sizeof(*open_spline_ranges) * tot_splines, __func__);
638 float(*diff_points)[2];
639 unsigned int tot_diff_point;
641 float(*diff_feather_points)[2];
642 float(*diff_feather_points_flip)[2];
643 unsigned int tot_diff_feather_points;
647 const unsigned int resol =
CLAMPIS(
MAX2(resol_a, resol_b), 4, 512);
653 spline, resol,
false, &tot_diff_feather_points);
657 tot_diff_feather_points = 0;
658 diff_feather_points =
NULL;
661 if (tot_diff_point > 3) {
670 if (do_aspect_correct) {
677 fp = &diff_points[0][0];
678 ffp = tot_diff_feather_points ? &diff_feather_points[0][0] :
NULL;
682 fp = &diff_points[0][1];
683 ffp = tot_diff_feather_points ? &diff_feather_points[0][1] :
NULL;
687 for (
uint i = 0; i < tot_diff_point; i++, fp += 2) {
688 (*fp) = (((*fp) - 0.5f) / asp) + 0.5f;
691 if (tot_diff_feather_points) {
692 for (
uint i = 0; i < tot_diff_feather_points; i++, ffp += 2) {
693 (*ffp) = (((*ffp) - 0.5f) / asp) + 0.5f;
700 if (do_mask_aa ==
true) {
701 if (do_feather ==
false) {
702 tot_diff_feather_points = tot_diff_point;
704 sizeof(*diff_feather_points) * (
size_t)tot_diff_feather_points, __func__);
707 diff_feather_points, diff_points, tot_diff_point, pixel_size,
false);
712 diff_feather_points, diff_points, tot_diff_point, pixel_size,
true);
720 spline, diff_feather_points, tot_diff_feather_points);
725 sf_vert_prev->
tmp.
u = sf_vert_tot;
728 sf_vert_prev->
keyindex = sf_vert_tot + tot_diff_point;
733 for (j = 1; j < tot_diff_point; j++) {
736 sf_vert->
tmp.
u = sf_vert_tot;
737 sf_vert->
keyindex = sf_vert_tot + tot_diff_point;
741 sf_vert = sf_vert_prev;
744 for (j = 0; j < tot_diff_point; j++) {
747 #ifdef USE_SCANFILL_EDGE_WORKAROUND
748 if (diff_feather_points) {
755 sf_vert_prev = sf_vert;
756 sf_vert = sf_vert->
next;
759 if (diff_feather_points) {
761 co_feather[2] = 1.0f;
763 BLI_assert(tot_diff_feather_points == tot_diff_point);
767 for (j = 0; j < tot_diff_feather_points; j++) {
768 copy_v2_v2(co_feather, diff_feather_points[j]);
774 tot_feather_quads += tot_diff_point;
779 if (diff_feather_points) {
784 co_feather[2] = 1.0f;
787 diff_feather_points_flip =
MEM_mallocN(
sizeof(
float[2]) * tot_diff_feather_points,
788 "diff_feather_points_flip");
790 for (j = 0; j < tot_diff_point; j++) {
791 sub_v2_v2v2(co_diff, diff_points[j], diff_feather_points[j]);
792 add_v2_v2v2(diff_feather_points_flip[j], diff_points[j], co_diff);
796 spline, diff_feather_points, tot_diff_feather_points);
798 spline, diff_feather_points_flip, tot_diff_feather_points);
801 diff_feather_points_flip =
NULL;
804 open_spline_ranges[open_spline_index].
vertex_offset = sf_vert_tot;
805 open_spline_ranges[open_spline_index].
vertex_total = tot_diff_point;
808 for (j = 0; j < tot_diff_point; j++) {
813 sf_vert->
tmp.
u = sf_vert_tot;
818 copy_v2_v2(co_feather, diff_feather_points[j]);
820 sf_vert->
tmp.
u = sf_vert_tot;
825 if (diff_feather_points_flip) {
826 copy_v2_v2(co_feather, diff_feather_points_flip[j]);
834 sf_vert->
tmp.
u = sf_vert_tot;
838 tot_feather_quads += 2;
842 tot_feather_quads -= 2;
845 if (diff_feather_points_flip) {
847 diff_feather_points_flip =
NULL;
857 const float *fp_cent;
858 const float *fp_turn;
862 fp_cent = diff_points[0];
863 fp_turn = diff_feather_points[0];
865 #define CALC_CAP_RESOL \
867 (unsigned int)(len_v2v2(fp_cent, fp_turn) / (pixel_size * SPLINE_RESOL_CAP_PER_PIXEL)), \
868 SPLINE_RESOL_CAP_MIN, \
869 SPLINE_RESOL_CAP_MAX)
874 for (k = 1; k < vertex_total_cap; k++) {
875 const float angle = (
float)k * (1.0f / (
float)vertex_total_cap) * (
float)
M_PI;
879 sf_vert->
tmp.
u = sf_vert_tot;
883 tot_feather_quads += vertex_total_cap;
888 fp_cent = diff_points[tot_diff_point - 1];
889 fp_turn = diff_feather_points[tot_diff_point - 1];
894 for (k = 1; k < vertex_total_cap; k++) {
895 const float angle = (
float)k * (1.0f / (
float)vertex_total_cap) * (
float)
M_PI;
899 sf_vert->
tmp.
u = sf_vert_tot;
903 tot_feather_quads += vertex_total_cap;
909 open_spline_ranges[open_spline_index].
is_cyclic = is_cyclic;
912 #undef CALC_CAP_RESOL
922 if (diff_feather_points) {
928 unsigned int(*face_array)[4], *face;
930 unsigned int sf_tri_tot;
932 unsigned int face_index;
933 int scanfill_flag = 0;
935 bool is_isect =
false;
940 face_coords =
MEM_mallocN((
sizeof(
float[3])) * sf_vert_tot,
"maskrast_face_coords");
946 cos = (
float *)face_coords;
948 sf_vert_next = sf_vert->
next;
968 &sf_ctx, &isect_remvertbase, &isect_remedgebase))) {
970 unsigned int i = sf_vert_tot;
973 sizeof(
float[3]) * (sf_vert_tot + sf_vert_tot_isect));
975 cos = (
float *)&face_coords[sf_vert_tot][0];
979 sf_vert->
tmp.
u = i++;
983 sf_vert_tot += sf_vert_tot_isect;
1005 ((
size_t)sf_tri_tot + (
size_t)tot_feather_quads),
1006 "maskrast_face_index");
1010 face = (
unsigned int *)face_array;
1012 *(face++) = sf_tri->
v3->
tmp.
u;
1013 *(face++) = sf_tri->
v2->
tmp.
u;
1014 *(face++) = sf_tri->
v1->
tmp.
u;
1025 if (tot_feather_quads) {
1030 *(face++) = sf_edge->
v1->
tmp.
u;
1031 *(face++) = sf_edge->
v2->
tmp.
u;
1037 #ifdef USE_SCANFILL_EDGE_WORKAROUND
1038 tot_boundary_found++;
1044 #ifdef USE_SCANFILL_EDGE_WORKAROUND
1045 if (tot_boundary_found != tot_boundary_used) {
1046 BLI_assert(tot_boundary_found < tot_boundary_used);
1051 while (open_spline_index > 0) {
1052 const unsigned int vertex_offset = open_spline_ranges[--open_spline_index].
vertex_offset;
1053 unsigned int vertex_total = open_spline_ranges[open_spline_index].
vertex_total;
1054 unsigned int vertex_total_cap_head =
1056 unsigned int vertex_total_cap_tail =
1063 for (k = 0; k < vertex_total - 1; k++, j += 3) {
1082 if (open_spline_ranges[open_spline_index].is_cyclic) {
1083 *(face++) = vertex_offset + 0;
1086 *(face++) = vertex_offset + 1;
1091 *(face++) = vertex_offset + 0;
1092 *(face++) = vertex_offset + 2;
1098 unsigned int midvidx = vertex_offset;
1102 j = midvidx + (vertex_total * 3);
1104 for (k = 0; k < vertex_total_cap_head - 2; k++, j++) {
1105 *(face++) = midvidx + 0;
1106 *(face++) = midvidx + 0;
1113 j = vertex_offset + (vertex_total * 3);
1116 *(face++) = midvidx + 0;
1117 *(face++) = midvidx + 0;
1118 *(face++) = midvidx + 1;
1123 *(face++) = midvidx + 0;
1124 *(face++) = midvidx + 0;
1125 *(face++) = j + vertex_total_cap_head - 2;
1126 *(face++) = midvidx + 2;
1134 j = vertex_offset + (vertex_total * 3) + (vertex_total_cap_head - 1);
1136 midvidx = vertex_offset + (vertex_total * 3) - 3;
1138 for (k = 0; k < vertex_total_cap_tail - 2; k++, j++) {
1139 *(face++) = midvidx;
1140 *(face++) = midvidx;
1147 j = vertex_offset + (vertex_total * 3) + (vertex_total_cap_head - 1);
1150 *(face++) = midvidx + 0;
1151 *(face++) = midvidx + 0;
1153 *(face++) = midvidx + 1;
1157 *(face++) = midvidx + 0;
1158 *(face++) = midvidx + 0;
1159 *(face++) = midvidx + 2;
1160 *(face++) = j + vertex_total_cap_tail - 2;
1170 "%u %u (%u %u), %u\n",
1172 sf_tri_tot + tot_feather_quads,
1175 tot_boundary_used - tot_boundary_found);
1178 #ifdef USE_SCANFILL_EDGE_WORKAROUND
1179 BLI_assert(face_index + (tot_boundary_used - tot_boundary_found) ==
1180 sf_tri_tot + tot_feather_quads);
1182 BLI_assert(face_index == sf_tri_tot + tot_feather_quads);
1188 #ifdef USE_SCANFILL_EDGE_WORKAROUND
1189 layer->
face_tot = (sf_tri_tot + tot_feather_quads) -
1190 (tot_boundary_used - tot_boundary_found);
1192 layer->
face_tot = (sf_tri_tot + tot_feather_quads);
1232 static float maskrasterize_layer_z_depth_tri(
const float pt[2],
1239 return (
v1[2] *
w[0]) + (
v2[2] *
w[1]) + (v3[2] *
w[2]);
1244 const float pt[2],
const float v1[3],
const float v2[3],
const float v3[3],
const float v4[3])
1254 const float dist_orig,
1263 if ((
cos[0][2] < dist_orig) || (
cos[1][2] < dist_orig) || (
cos[2][2] < dist_orig)) {
1266 return maskrasterize_layer_z_depth_tri(xy,
cos[face[0]],
cos[face[1]],
cos[face[2]]);
1280 if ((
cos[0][2] < dist_orig) || (
cos[1][2] < dist_orig) || (
cos[2][2] < dist_orig) ||
1281 (
cos[3][2] < dist_orig)) {
1290 xy,
cos[face[0]],
cos[face[1]],
cos[face[2]],
cos[face[3]]);
1296 return maskrasterize_layer_z_depth_tri(xy,
cos[face[0]],
cos[face[1]],
cos[face[2]]);
1299 return maskrasterize_layer_z_depth_tri(xy,
cos[face[0]],
cos[face[2]],
cos[face[3]]);
1326 unsigned int(*face_array)[4] = layer->
face_array;
1328 float best_dist = 1.0f;
1331 face_array[*face_index],
cos, best_dist, xy);
1332 if (test_dist < best_dist) {
1333 best_dist = test_dist;
1335 if (best_dist == 0.0f) {
1353 const unsigned int layers_tot = mr_handle->
layers_tot;
1359 for (
uint i = 0; i < layers_tot; i++, layer++) {
1369 value_layer = (3.0f * value_layer * value_layer -
1370 2.0f * value_layer * value_layer * value_layer);
1373 value_layer =
sqrtf(2.0f * value_layer - value_layer * value_layer);
1376 value_layer =
sqrtf(value_layer);
1379 value_layer = value_layer * value_layer;
1382 value_layer = value_layer * (2.0f - value_layer);
1391 value_layer *= layer->
alpha;
1399 value_layer = 1.0f - value_layer;
1402 switch (layer->
blend) {
1404 value += value_layer * (1.0f - value);
1407 value -= value_layer * value;
1410 value += value_layer;
1413 value -= value_layer;
1416 value =
max_ff(value, value_layer);
1419 value =
min_ff(value, value_layer);
1422 value *= value_layer;
1425 value = (value * (1.0f - layer->
alpha)) + (value_layer * layer->
alpha);
1428 value =
fabsf(value - value_layer);
1433 value += value_layer;
1439 CLAMP(value, 0.0f, 1.0f);
1464 const float x_inv =
data->x_inv;
1465 const float x_px_ofs =
data->x_px_ofs;
1471 xy[0] = ((
float)
x * x_inv) + x_px_ofs;
1481 const unsigned int width,
1482 const unsigned int height,
1491 .mr_handle = mr_handle,
1494 .x_px_ofs = x_inv * 0.5f,
1495 .y_px_ofs = y_inv * 0.5f,
typedef float(TangentPoint)[2]
unsigned int BKE_mask_spline_feather_resolution(struct MaskSpline *spline, int width, int height)
float(* BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, const unsigned int resol, unsigned int *r_tot_diff_point))[2]
void BKE_mask_spline_feather_collapse_inner_loops(struct MaskSpline *spline, float(*feather_points)[2], const unsigned int tot_feather_point)
float(* BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, const unsigned int resol, const bool do_feather_isect, unsigned int *r_tot_feather_point))[2]
unsigned int BKE_mask_spline_resolution(struct MaskSpline *spline, int width, int height)
void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, struct MemArena *ma) ATTR_NONNULL(1
void void void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src) ATTR_NONNULL(1
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE int min_ii(int a, int b)
MINLINE float min_ff(float a, float b)
void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3])
bool isect_point_tri_v2_cw(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
void barycentric_weights_v2_quad(const float v1[2], const float v2[2], const float v3[2], const float v4[2], const float co[2], float w[4])
int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float normalize_v2(float r[2])
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
struct MemArena * BLI_memarena_new(const size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2) ATTR_MALLOC
bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2])
bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest)
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
void BLI_rctf_do_minmax_v(struct rctf *rect, const float xy[2])
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
void BLI_rctf_union(struct rctf *rct1, const struct rctf *rct2)
void BLI_rctf_init_minmax(struct rctf *rect)
struct ScanFillVert * BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3])
struct ScanFillEdge * BLI_scanfill_edge_add(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2)
@ BLI_SCANFILL_CALC_POLYS
@ BLI_SCANFILL_CALC_HOLES
bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx, ListBase *fillvertbase, ListBase *filledgebase)
void BLI_scanfill_begin_arena(ScanFillContext *sf_ctx, struct MemArena *arena)
#define BLI_SCANFILL_ARENA_SIZE
void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, struct MemArena *arena)
unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float nor_proj[3])
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
void BLI_task_parallel_range(const int start, const int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
#define POINTER_AS_UINT(i)
#define POINTER_FROM_UINT(i)
#define CLOG_ERROR(clg_ref,...)
@ MASK_LAYERFLAG_FILL_OVERLAP
@ MASK_LAYERFLAG_FILL_DISCRETE
#define MASK_RESTRICT_RENDER
@ MASK_BLEND_MERGE_SUBTRACT
@ MASK_SPLINE_NOINTERSECT
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
#define MEM_SIZE_OPTIMAL(size)
#define MEM_reallocN(vmemh, len)
Group RGB to Bright Vector Camera CLAMP
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
#define SF_EDGE_IS_BOUNDARY
struct MaskRasterSplineInfo MaskRasterSplineInfo
void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask, const int width, const int height, const bool do_aspect_correct, const bool do_mask_aa, const bool do_feather)
struct MaskRasterizeBufferData MaskRasterizeBufferData
float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2])
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, const unsigned int width, const unsigned int height, float *buffer)
Rasterize a buffer from a single mask (threaded execution).
#define FACE_ASSERT(face, vert_max)
#define SF_KEYINDEX_TEMP_ID
static void rotate_point_v2(float r_p[2], const float p[2], const float cent[2], const float angle, const float asp[2])
static float maskrasterize_layer_z_depth_quad(const float pt[2], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
static void maskrasterize_spline_differentiate_point_outset(float(*diff_feather_points)[2], float(*diff_points)[2], const unsigned int tot_diff_point, const float ofs, const bool do_test)
static float layer_bucket_depth_from_xy(MaskRasterLayer *layer, const float xy[2])
static float maskrasterize_layer_isect(const unsigned int *face, float(*cos)[3], const float dist_orig, const float xy[2])
BLI_INLINE unsigned int layer_bucket_index_from_xy(MaskRasterLayer *layer, const float xy[2])
#define TRI_TERMINATOR_ID
#define BUCKET_PIXELS_PER_CELL
static void layer_bucket_init_dummy(MaskRasterLayer *layer)
BLI_INLINE unsigned int clampis_uint(const unsigned int v, const unsigned int min, const unsigned int max)
static bool layer_bucket_isect_test(const MaskRasterLayer *layer, unsigned int face_index, const unsigned int bucket_x, const unsigned int bucket_y, const float bucket_size_x, const float bucket_size_y, const float bucket_max_rad_squared)
MaskRasterHandle * BKE_maskrasterize_handle_new(void)
struct MaskRasterLayer MaskRasterLayer
static void maskrasterize_buffer_cb(void *__restrict userdata, const int y, const TaskParallelTLS *__restrict UNUSED(tls))
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
unsigned int ** buckets_face
unsigned int(* face_array)[4]
float buckets_xy_scalar[2]
unsigned int vertex_total
unsigned int vertex_offset
unsigned int vertex_total_cap_tail
unsigned int vertex_total_cap_head
MaskRasterHandle * mr_handle
union ScanFillEdge::@120 tmp
struct ScanFillEdge * next
struct ScanFillFace * next
struct ScanFillVert * next
union ScanFillVert::@119 tmp
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)