Blender V5.0
BLI_bitmap.h File Reference
#include "BLI_utildefines.h"

Go to the source code of this file.

Macros

#define _BITMAP_POWER   5
#define _BITMAP_MASK   31
#define _BITMAP_NUM_BLOCKS(_num)
#define BLI_BITMAP_SIZE(_num)
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BLI_BITMAP_NEW_ALLOCA(_num)
#define BLI_BITMAP_NEW_MEMARENA(_mem, _num)
#define BLI_BITMAP_DECLARE(_name, _num)
#define BLI_BITMAP_TEST(_bitmap, _index)
#define BLI_BITMAP_TEST_AND_SET_ATOMIC(_bitmap, _index)
#define BLI_BITMAP_TEST_BOOL(_bitmap, _index)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
#define BLI_BITMAP_DISABLE(_bitmap, _index)
#define BLI_BITMAP_FLIP(_bitmap, _index)
#define BLI_BITMAP_SET(_bitmap, _index, _set)
#define BLI_BITMAP_RESIZE(_bitmap, _num)

Typedefs

typedef unsigned int BLI_bitmap

Functions

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)
int BLI_bitmap_find_first_unset (const BLI_bitmap *bitmap, size_t bits)

Macro Definition Documentation

◆ _BITMAP_MASK

#define _BITMAP_MASK   31

Definition at line 22 of file BLI_bitmap.h.

◆ _BITMAP_NUM_BLOCKS

#define _BITMAP_NUM_BLOCKS ( _num)
Value:
(((_num) + _BITMAP_MASK) >> _BITMAP_POWER)
#define _BITMAP_POWER
Definition BLI_bitmap.h:20
#define _BITMAP_MASK
Definition BLI_bitmap.h:22

Number of blocks needed to hold '_num' bits.

Definition at line 27 of file BLI_bitmap.h.

Referenced by BLI_bitmap_and_all(), BLI_bitmap_find_first_unset(), BLI_bitmap_flip_all(), and BLI_bitmap_or_all().

◆ _BITMAP_POWER

#define _BITMAP_POWER   5

Definition at line 20 of file BLI_bitmap.h.

Referenced by BLI_bitmap_find_first_unset().

◆ BLI_BITMAP_DECLARE

#define BLI_BITMAP_DECLARE ( _name,
_num )
Value:
BLI_bitmap _name[_BITMAP_NUM_BLOCKS(_num)] = {}
#define _BITMAP_NUM_BLOCKS(_num)
Definition BLI_bitmap.h:27
unsigned int BLI_bitmap
Definition BLI_bitmap.h:13

Declares a bitmap as a variable.

Definition at line 56 of file BLI_bitmap.h.

Referenced by blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), and blender::tests::TEST().

◆ BLI_BITMAP_DISABLE

#define BLI_BITMAP_DISABLE ( _bitmap,
_index )

◆ BLI_BITMAP_ENABLE

#define BLI_BITMAP_ENABLE ( _bitmap,
_index )
Value:
(CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \
((_bitmap)[(_index) >> _BITMAP_POWER] |= (1u << ((_index) & _BITMAP_MASK))))

Set the value of a single bit at '_index'.

Definition at line 78 of file BLI_bitmap.h.

Referenced by BKE_lattice_bitmap_from_flag(), BLI_astar_graph_solve(), BM_lnorspace_invalidate(), bm_loop_normal_mark_indiv_do_loop(), bm_mesh_loops_assign_normal_data(), bm_mesh_loops_split_lnor_fans(), build_emats_stack(), cage_mapped_verts_callback(), curve_select_less(), curve_select_more(), DRW_select_buffer_bitmap_from_circle(), DRW_select_buffer_bitmap_from_poly(), DRW_select_buffer_bitmap_from_rect(), drw_select_mask_px_cb(), edbm_set_normals_from_faces_exec(), face_edge_loop_islands_calc(), gather_frames_to_render(), gather_frames_to_render_for_adt(), gather_frames_to_render_for_grease_pencil(), get_vertexcos__mapFunc(), blender::gpu::GLShaderInterface::GLShaderInterface(), gradientVertInit__mapFunc(), hook_index_array_to_bitmap(), mesh_calc_hq_normal(), mesh_island_to_astar_graph_edge_process(), mesh_remove_doubles_on_axis(), MOD_get_texture_coords(), MOD_solidify_extrude_modifyMesh(), nla_eval_domain_action(), nlaevalchan_blend_value_get_inverted_lower_evalchan(), nlaevalchan_combine_value_get_inverted_lower_evalchan(), nlasnapshot_from_action(), normalEditModifier_do_directional(), normalEditModifier_do_radial(), pyrna_enum_bitmap_from_set(), similar_vert_select_exec(), blender::ed::object::skin_armature_bone_create(), blender::bke::subdiv::subdiv_foreach_mark_non_loose_geometry(), blender::tests::TEST(), and blender::ed::object::vgroup_mirror().

◆ BLI_BITMAP_FLIP

#define BLI_BITMAP_FLIP ( _bitmap,
_index )
Value:
(CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \
((_bitmap)[(_index) >> _BITMAP_POWER] ^= (1u << ((_index) & _BITMAP_MASK))))

Flip the value of a single bit at '_index'.

Definition at line 92 of file BLI_bitmap.h.

◆ BLI_BITMAP_NEW

#define BLI_BITMAP_NEW ( _num,
_alloc_string )
Value:
((BLI_bitmap *)MEM_callocN(BLI_BITMAP_SIZE(_num), _alloc_string))
#define BLI_BITMAP_SIZE(_num)
Definition BLI_bitmap.h:32
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118

Allocate memory for a bitmap with '_num' bits; free with MEM_freeN().

Definition at line 37 of file BLI_bitmap.h.

Referenced by BKE_editmesh_vert_coords_alloc(), BKE_mesh_foreach_mapped_vert_coords_get(), BM_lnorspace_invalidate(), BM_loop_normal_editdata_array_init_with_htype(), bm_mesh_loops_assign_normal_data(), bm_mesh_loops_split_lnor_fans(), build_edge_mats(), buttons_duplicate(), buttons_init(), curve_select_less(), curve_select_more(), curve_select_random_exec(), DRW_select_buffer_bitmap_from_circle(), DRW_select_buffer_bitmap_from_poly(), DRW_select_buffer_bitmap_from_rect(), ed_lattice_select_mirrored(), edbm_set_normals_from_faces_exec(), blender::draw::extract_lines_paint_mask(), blender::draw::extract_lines_paint_mask_subdiv(), face_edge_loop_islands_calc(), gather_frames_to_render(), blender::gpu::GLShaderInterface::GLShaderInterface(), hook_index_array_to_bitmap(), lattice_select_more_less(), mesh_island_to_astar_graph(), mesh_remove_doubles_on_axis(), MOD_get_texture_coords(), MOD_solidify_extrude_modifyMesh(), blender::ed::object::modifier_skin_armature_create(), multires_mdisps_downsample_hidden(), nlavalidmask_init(), normalEditModifier_do_directional(), normalEditModifier_do_radial(), paint_2d_bucket_fill(), paint_weight_gradient_exec(), pyrna_enum_bitmap_from_set(), similar_vert_select_exec(), blender::bke::subdiv::subdiv_foreach_ctx_init(), and blender::ed::object::vgroup_mirror().

◆ BLI_BITMAP_NEW_ALLOCA

#define BLI_BITMAP_NEW_ALLOCA ( _num)
Value:
((BLI_bitmap *)memset(alloca(BLI_BITMAP_SIZE(_num)), 0, BLI_BITMAP_SIZE(_num)))

Allocate a bitmap on the stack.

Definition at line 43 of file BLI_bitmap.h.

◆ BLI_BITMAP_NEW_MEMARENA

#define BLI_BITMAP_NEW_MEMARENA ( _mem,
_num )
Value:
#define CHECK_TYPE_INLINE(val, type)
void * BLI_memarena_calloc(MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)

Allocate using given MemArena.

Definition at line 49 of file BLI_bitmap.h.

Referenced by BLI_astar_solution_init().

◆ BLI_BITMAP_RESIZE

#define BLI_BITMAP_RESIZE ( _bitmap,
_num )
Value:
{ \
CHECK_TYPE(_bitmap, BLI_bitmap *); \
(_bitmap) = (unsigned int *)MEM_recallocN(_bitmap, BLI_BITMAP_SIZE(_num)); \
} \
(void)0
#define MEM_recallocN(vmemh, len)

Resize bitmap to have space for '_num' bits.

Definition at line 114 of file BLI_bitmap.h.

◆ BLI_BITMAP_SET

◆ BLI_BITMAP_SIZE

#define BLI_BITMAP_SIZE ( _num)
Value:
((size_t)(_BITMAP_NUM_BLOCKS(_num)) * sizeof(BLI_bitmap))

Size (in bytes) used to hold '_num' bits.

Definition at line 32 of file BLI_bitmap.h.

Referenced by blend_read_mdisps(), BLI_bitmap_copy_all(), BLI_bitmap_set_all(), nlavalidmask_init(), and write_mdisps().

◆ BLI_BITMAP_TEST

#define BLI_BITMAP_TEST ( _bitmap,
_index )

◆ BLI_BITMAP_TEST_AND_SET_ATOMIC

#define BLI_BITMAP_TEST_AND_SET_ATOMIC ( _bitmap,
_index )

◆ BLI_BITMAP_TEST_BOOL

Typedef Documentation

◆ BLI_bitmap

Definition at line 13 of file BLI_bitmap.h.

Function Documentation

◆ BLI_bitmap_and_all()

void BLI_bitmap_and_all ( BLI_bitmap * dst,
const BLI_bitmap * src,
size_t bits )

Combine two bitmaps with boolean AND.

Definition at line 35 of file bitmap.cc.

References _BITMAP_NUM_BLOCKS, and i.

◆ BLI_bitmap_copy_all()

void BLI_bitmap_copy_all ( BLI_bitmap * dst,
const BLI_bitmap * src,
size_t bits )

Copy all bits from one bitmap to another.

Definition at line 30 of file bitmap.cc.

References BLI_BITMAP_SIZE.

Referenced by nlaevalchan_blendOrcombine_try_copy_to_lower().

◆ BLI_bitmap_find_first_unset()

int BLI_bitmap_find_first_unset ( const BLI_bitmap * bitmap,
size_t bits )

Find index of the lowest unset bit. Returns -1 if all the bits are set.

Definition at line 51 of file bitmap.cc.

References _BITMAP_NUM_BLOCKS, _BITMAP_POWER, bitscan_forward_uint(), BLI_assert, and result.

Referenced by blender::tests::TEST(), blender::tests::TEST(), and blender::tests::TEST().

◆ BLI_bitmap_flip_all()

void BLI_bitmap_flip_all ( BLI_bitmap * bitmap,
size_t bits )

Invert all bits in the bitmap.

Definition at line 22 of file bitmap.cc.

References _BITMAP_NUM_BLOCKS, and i.

Referenced by blender::tests::TEST(), and blender::tests::TEST().

◆ BLI_bitmap_or_all()

void BLI_bitmap_or_all ( BLI_bitmap * dst,
const BLI_bitmap * src,
size_t bits )

Combine two bitmaps with boolean OR.

Definition at line 43 of file bitmap.cc.

References _BITMAP_NUM_BLOCKS, and i.

◆ BLI_bitmap_set_all()