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:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-12-15 11:47:24 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-12-19 15:53:12 +0300
commitd211c9aa0aaa68fe126ce632746b705903d03173 (patch)
treefbcc4533fc4a62d2c75d3626594fae039cf3ad2d /source/blender/blenlib/BLI_bitmap.h
parentdad260c164adf0f86853e2f8046916739fccaffd (diff)
BLI_bitmap: add functions operating on the whole bitmask.
There is no point having operations that iterate over the whole bit array as macros, so convert BLI_BITMAP_SET_ALL to a function. Also, add more utilities for copying and manipulating masks. Reviewers: brecht, campbellbarton Differential Revision: https://developer.blender.org/D4101
Diffstat (limited to 'source/blender/blenlib/BLI_bitmap.h')
-rw-r--r--source/blender/blenlib/BLI_bitmap.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h
index 8e873c76dc9..c3be39c5bc5 100644
--- a/source/blender/blenlib/BLI_bitmap.h
+++ b/source/blender/blenlib/BLI_bitmap.h
@@ -107,16 +107,6 @@ typedef unsigned int BLI_bitmap;
BLI_BITMAP_DISABLE(_bitmap, _index); \
} (void)0
-/* set or clear the value of the whole bitmap (needs size info) */
-#define BLI_BITMAP_SET_ALL(_bitmap, _set, _tot) \
- { \
- CHECK_TYPE(_bitmap, BLI_bitmap *); \
- if (_set) \
- memset(_bitmap, UCHAR_MAX, BLI_BITMAP_SIZE(_tot)); \
- else \
- memset(_bitmap, 0, BLI_BITMAP_SIZE(_tot)); \
- } (void)0
-
/* resize bitmap to have space for '_tot' bits */
#define BLI_BITMAP_RESIZE(_bitmap, _tot) \
{ \
@@ -124,4 +114,10 @@ typedef unsigned int BLI_bitmap;
(_bitmap) = MEM_reallocN(_bitmap, BLI_BITMAP_SIZE(_tot)); \
} (void)0
+void BLI_bitmap_set_all(BLI_bitmap *bitmap, bool set, size_t bits);
+void BLI_bitmap_flip_all(BLI_bitmap *bitmap, size_t bits);
+void BLI_bitmap_copy_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits);
+void BLI_bitmap_and_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits);
+void BLI_bitmap_or_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits);
+
#endif