BLI_bitmap: add a macro to set/clear the whole bitmap at once.

This commit is contained in:
Bastien Montagne
2014-10-14 09:28:32 +02:00
parent 79aa9feee8
commit cd2295f93e
2 changed files with 11 additions and 3 deletions

View File

@@ -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);
}
}

View File

@@ -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) \
{ \