Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/mask_rasterize.c')
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c98
1 files changed, 47 insertions, 51 deletions
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 2bbf9e8d891..b9ea3eaba69 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -93,7 +93,7 @@
// printf("%u %u %u %u\n", _t[0], _t[1], _t[2], _t[3]);
# define FACE_ASSERT(face, vert_max) \
{ \
- unsigned int *_t = face; \
+ uint *_t = face; \
BLI_assert(_t[0] < vert_max); \
BLI_assert(_t[1] < vert_max); \
BLI_assert(_t[2] < vert_max); \
@@ -493,7 +493,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
uint bucket_index = (layer->buckets_x * yi) + xi_min;
for (xi = xi_min; xi <= xi_max; xi++, bucket_index++) {
/* correct but do in outer loop */
- // unsigned int bucket_index = (layer->buckets_x * yi) + xi;
+ // uint bucket_index = (layer->buckets_x * yi) + xi;
BLI_assert(xi < layer->buckets_x);
BLI_assert(yi < layer->buckets_y);
@@ -570,10 +570,10 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
const float zvec[3] = {0.0f, 0.0f, -1.0f};
MaskLayer *masklay;
- unsigned int masklay_index;
+ uint masklay_index;
MemArena *sf_arena;
- mr_handle->layers_tot = (unsigned int)BLI_listbase_count(&mask->masklayers);
+ mr_handle->layers_tot = (uint)BLI_listbase_count(&mask->masklayers);
mr_handle->layers = MEM_mallocN(sizeof(MaskRasterLayer) * mr_handle->layers_tot,
"MaskRasterLayer");
BLI_rctf_init_minmax(&mr_handle->bounds);
@@ -584,9 +584,9 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
masklay = masklay->next, masklay_index++) {
/* we need to store vertex ranges for open splines for filling */
- unsigned int tot_splines;
+ uint tot_splines;
MaskRasterSplineInfo *open_spline_ranges;
- unsigned int open_spline_index = 0;
+ uint open_spline_index = 0;
MaskSpline *spline;
@@ -596,12 +596,12 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
ScanFillVert *sf_vert_next = NULL;
ScanFillFace *sf_tri;
- unsigned int sf_vert_tot = 0;
- unsigned int tot_feather_quads = 0;
+ uint sf_vert_tot = 0;
+ uint tot_feather_quads = 0;
#ifdef USE_SCANFILL_EDGE_WORKAROUND
- unsigned int tot_boundary_used = 0;
- unsigned int tot_boundary_found = 0;
+ uint tot_boundary_used = 0;
+ uint tot_boundary_found = 0;
#endif
if (masklay->visibility_flag & MASK_HIDE_RENDER) {
@@ -611,7 +611,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
continue;
}
- tot_splines = (unsigned int)BLI_listbase_count(&masklay->splines);
+ tot_splines = (uint)BLI_listbase_count(&masklay->splines);
open_spline_ranges = MEM_callocN(sizeof(*open_spline_ranges) * tot_splines, __func__);
BLI_scanfill_begin_arena(&sf_ctx, sf_arena);
@@ -621,15 +621,15 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
const bool is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0;
float(*diff_points)[2];
- unsigned int tot_diff_point;
+ uint tot_diff_point;
float(*diff_feather_points)[2];
float(*diff_feather_points_flip)[2];
- unsigned int tot_diff_feather_points;
+ uint tot_diff_feather_points;
- const unsigned int resol_a = BKE_mask_spline_resolution(spline, width, height) / 4;
- const unsigned int resol_b = BKE_mask_spline_feather_resolution(spline, width, height) / 4;
- const unsigned int resol = CLAMPIS(MAX2(resol_a, resol_b), 4, 512);
+ const uint resol_a = BKE_mask_spline_resolution(spline, width, height) / 4;
+ const uint resol_b = BKE_mask_spline_feather_resolution(spline, width, height) / 4;
+ const uint resol = CLAMPIS(MAX2(resol_a, resol_b), 4, 512);
diff_points = BKE_mask_spline_differentiate_with_resolution(spline, resol, &tot_diff_point);
@@ -645,7 +645,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
if (tot_diff_point > 3) {
ScanFillVert *sf_vert_prev;
- unsigned int j;
+ uint j;
sf_ctx.poly_nr++;
@@ -828,19 +828,18 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
const float *fp_cent;
const float *fp_turn;
- unsigned int k;
+ uint k;
fp_cent = diff_points[0];
fp_turn = diff_feather_points[0];
#define CALC_CAP_RESOL \
- clampis_uint( \
- (unsigned int)(len_v2v2(fp_cent, fp_turn) / (pixel_size * SPLINE_RESOL_CAP_PER_PIXEL)), \
- SPLINE_RESOL_CAP_MIN, \
- SPLINE_RESOL_CAP_MAX)
+ clampis_uint((uint)(len_v2v2(fp_cent, fp_turn) / (pixel_size * SPLINE_RESOL_CAP_PER_PIXEL)), \
+ SPLINE_RESOL_CAP_MIN, \
+ SPLINE_RESOL_CAP_MAX)
{
- const unsigned int vertex_total_cap = CALC_CAP_RESOL;
+ const uint vertex_total_cap = CALC_CAP_RESOL;
for (k = 1; k < vertex_total_cap; k++) {
const float angle = (float)k * (1.0f / (float)vertex_total_cap) * (float)M_PI;
@@ -861,7 +860,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
fp_turn = diff_feather_points[tot_diff_point - 1];
{
- const unsigned int vertex_total_cap = CALC_CAP_RESOL;
+ const uint vertex_total_cap = CALC_CAP_RESOL;
for (k = 1; k < vertex_total_cap; k++) {
const float angle = (float)k * (1.0f / (float)vertex_total_cap) * (float)M_PI;
@@ -898,11 +897,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
}
{
- unsigned int(*face_array)[4], *face; /* access coords */
- float(*face_coords)[3], *cos; /* xy, z 0-1 (1.0 == filled) */
- unsigned int sf_tri_tot;
+ uint(*face_array)[4], *face; /* access coords */
+ float(*face_coords)[3], *cos; /* xy, z 0-1 (1.0 == filled) */
+ uint sf_tri_tot;
rctf bounds;
- unsigned int face_index;
+ uint face_index;
int scanfill_flag = 0;
bool is_isect = false;
@@ -939,8 +938,8 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
if ((masklay->flag & MASK_LAYERFLAG_FILL_OVERLAP) &&
(is_isect = BLI_scanfill_calc_self_isect(
&sf_ctx, &isect_remvertbase, &isect_remedgebase))) {
- unsigned int sf_vert_tot_isect = (unsigned int)BLI_listbase_count(&sf_ctx.fillvertbase);
- unsigned int i = sf_vert_tot;
+ uint sf_vert_tot_isect = (uint)BLI_listbase_count(&sf_ctx.fillvertbase);
+ uint i = sf_vert_tot;
face_coords = MEM_reallocN(face_coords,
sizeof(float[3]) * (sf_vert_tot + sf_vert_tot_isect));
@@ -965,7 +964,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
scanfill_flag |= BLI_SCANFILL_CALC_HOLES;
}
- sf_tri_tot = (unsigned int)BLI_scanfill_calc_ex(&sf_ctx, scanfill_flag, zvec);
+ sf_tri_tot = (uint)BLI_scanfill_calc_ex(&sf_ctx, scanfill_flag, zvec);
if (is_isect) {
/* add removed data back, we only need edges for feather,
@@ -980,7 +979,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
face_index = 0;
/* faces */
- face = (unsigned int *)face_array;
+ face = (uint *)face_array;
for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
*(face++) = sf_tri->v3->tmp.u;
*(face++) = sf_tri->v2->tmp.u;
@@ -1022,13 +1021,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
/* feather only splines */
while (open_spline_index > 0) {
- const unsigned int vertex_offset = open_spline_ranges[--open_spline_index].vertex_offset;
- unsigned int vertex_total = open_spline_ranges[open_spline_index].vertex_total;
- unsigned int vertex_total_cap_head =
- open_spline_ranges[open_spline_index].vertex_total_cap_head;
- unsigned int vertex_total_cap_tail =
- open_spline_ranges[open_spline_index].vertex_total_cap_tail;
- unsigned int k, j;
+ const uint vertex_offset = open_spline_ranges[--open_spline_index].vertex_offset;
+ uint vertex_total = open_spline_ranges[open_spline_index].vertex_total;
+ uint vertex_total_cap_head = open_spline_ranges[open_spline_index].vertex_total_cap_head;
+ uint vertex_total_cap_tail = open_spline_ranges[open_spline_index].vertex_total_cap_tail;
+ uint k, j;
j = vertex_offset;
@@ -1068,7 +1065,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
FACE_ASSERT(face - 4, sf_vert_tot);
}
else {
- unsigned int midvidx = vertex_offset;
+ uint midvidx = vertex_offset;
/***************
* cap end 'a' */
@@ -1222,7 +1219,7 @@ static float maskrasterize_layer_z_depth_quad(
return w[2] + w[3]; /* we can make this assumption for small speedup */
}
-static float maskrasterize_layer_isect(const unsigned int *face,
+static float maskrasterize_layer_isect(const uint *face,
float (*cos)[3],
const float dist_orig,
const float xy[2])
@@ -1281,22 +1278,21 @@ static float maskrasterize_layer_isect(const unsigned int *face,
return 1.0f;
}
-BLI_INLINE unsigned int layer_bucket_index_from_xy(MaskRasterLayer *layer, const float xy[2])
+BLI_INLINE uint layer_bucket_index_from_xy(MaskRasterLayer *layer, const float xy[2])
{
BLI_assert(BLI_rctf_isect_pt_v(&layer->bounds, xy));
- return ((unsigned int)((xy[0] - layer->bounds.xmin) * layer->buckets_xy_scalar[0])) +
- (((unsigned int)((xy[1] - layer->bounds.ymin) * layer->buckets_xy_scalar[1])) *
- layer->buckets_x);
+ return ((uint)((xy[0] - layer->bounds.xmin) * layer->buckets_xy_scalar[0])) +
+ (((uint)((xy[1] - layer->bounds.ymin) * layer->buckets_xy_scalar[1])) * layer->buckets_x);
}
static float layer_bucket_depth_from_xy(MaskRasterLayer *layer, const float xy[2])
{
- unsigned int index = layer_bucket_index_from_xy(layer, xy);
- unsigned int *face_index = layer->buckets_face[index];
+ uint index = layer_bucket_index_from_xy(layer, xy);
+ uint *face_index = layer->buckets_face[index];
if (face_index) {
- unsigned int(*face_array)[4] = layer->face_array;
+ uint(*face_array)[4] = layer->face_array;
float(*cos)[3] = layer->face_coords;
float best_dist = 1.0f;
while (*face_index != TRI_TERMINATOR_ID) {
@@ -1323,7 +1319,7 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
/* can't do this because some layers may invert */
/* if (BLI_rctf_isect_pt_v(&mr_handle->bounds, xy)) */
- const unsigned int layers_tot = mr_handle->layers_tot;
+ const uint layers_tot = mr_handle->layers_tot;
MaskRasterLayer *layer = mr_handle->layers;
/* return value */
@@ -1448,8 +1444,8 @@ static void maskrasterize_buffer_cb(void *__restrict userdata,
}
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle,
- const unsigned int width,
- const unsigned int height,
+ const uint width,
+ const uint height,
/* Cannot be const, because it is assigned to non-const variable.
* NOLINTNEXTLINE: readability-non-const-parameter. */
float *buffer)