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:
authorBastien Montagne <montagne29@wanadoo.fr>2014-10-14 11:28:32 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-10-14 11:40:35 +0400
commitcd2295f93e11bb53696e5011b083b72d74cdf707 (patch)
tree5c580f18729fbe9a473b5de1f6ae48773fee5a02 /source/blender
parent79aa9feee84a0493ac34ffbd4f4f0500ddcd139f (diff)
BLI_bitmap: add a macro to set/clear the whole bitmap at once.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/multires.c4
-rw-r--r--source/blender/blenlib/BLI_bitmap.h10
2 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 246ef8a33f5..df992cc9aed 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -272,9 +272,7 @@ static MDisps *multires_mdisps_initialize_hidden(Mesh *me, int level)
BLI_assert(!md->hidden);
md->hidden = BLI_BITMAP_NEW(gridarea, "MDisps.hidden initialize");
-
- for (k = 0; k < gridarea; k++)
- BLI_BITMAP_ENABLE(md->hidden, k);
+ BLI_BITMAP_SET_ALL(md->hidden, true, gridarea);
}
}
diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h
index 5431785aa84..594bf89b667 100644
--- a/source/blender/blenlib/BLI_bitmap.h
+++ b/source/blender/blenlib/BLI_bitmap.h
@@ -91,6 +91,16 @@ 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) \
{ \