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:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-03-09 22:02:40 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-03-09 22:03:56 +0300
commitcfd7b4d1cd48ecffbf61d45dfa4f24ccda3d6a71 (patch)
treed15eba83bd4baae7853a69c4dbe178fead669769 /source/blender/blenlib/BLI_array_utils.h
parent80f7f1070f177ae543f2fa35dd5d458e87ff30c1 (diff)
BLI: New 'BLI_array_iter_spiral_square'
No functional changes. This function replaces some of the logic in `DRW_select_buffer_find_nearest_to_point` that traverses a buffer in a spiral way to search for a closer pixel (not the closest). Differential Revision: https://developer.blender.org/D10548
Diffstat (limited to 'source/blender/blenlib/BLI_array_utils.h')
-rw-r--r--source/blender/blenlib/BLI_array_utils.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_array_utils.h b/source/blender/blenlib/BLI_array_utils.h
index bd37d22023b..8f4630dd732 100644
--- a/source/blender/blenlib/BLI_array_utils.h
+++ b/source/blender/blenlib/BLI_array_utils.h
@@ -89,6 +89,14 @@ bool _bli_array_iter_span(const void *arr,
bool _bli_array_is_zeroed(const void *arr, unsigned int arr_len, size_t arr_stride);
#define BLI_array_is_zeroed(arr, arr_len) _bli_array_is_zeroed(arr, arr_len, sizeof(*(arr)))
+bool _bli_array_iter_spiral_square(const void *arr_v,
+ const int arr_shape[2],
+ const size_t elem_size,
+ const int center[2],
+ const bool (*test_fn)(const void *arr_item, void *user_data),
+ void *user_data);
+#define BLI_array_iter_spiral_square(arr, arr_shape, center, test_fn, user_data) \
+ _bli_array_iter_spiral_square(arr, arr_shape, sizeof(*(arr)), center, test_fn, user_data)
#ifdef __cplusplus
}
#endif