Blender V4.3
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)   (((_num) + _BITMAP_MASK) >> _BITMAP_POWER)
 
#define BLI_BITMAP_SIZE(_num)   ((size_t)(_BITMAP_NUM_BLOCKS(_num)) * sizeof(BLI_bitmap))
 
#define BLI_BITMAP_NEW(_num, _alloc_string)    ((BLI_bitmap *)MEM_callocN(BLI_BITMAP_SIZE(_num), _alloc_string))
 
#define BLI_BITMAP_NEW_ALLOCA(_num)    ((BLI_bitmap *)memset(alloca(BLI_BITMAP_SIZE(_num)), 0, BLI_BITMAP_SIZE(_num)))
 
#define BLI_BITMAP_NEW_MEMARENA(_mem, _num)
 
#define BLI_BITMAP_DECLARE(_name, _num)   BLI_bitmap _name[_BITMAP_NUM_BLOCKS(_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 26 of file BLI_bitmap.h.

◆ _BITMAP_NUM_BLOCKS

#define _BITMAP_NUM_BLOCKS ( _num)    (((_num) + _BITMAP_MASK) >> _BITMAP_POWER)

Number of blocks needed to hold '_num' bits.

Definition at line 31 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 24 of file BLI_bitmap.h.

Referenced by BLI_bitmap_find_first_unset().

◆ BLI_BITMAP_DECLARE

#define BLI_BITMAP_DECLARE ( _name,
_num )   BLI_bitmap _name[_BITMAP_NUM_BLOCKS(_num)] = {}

Declares a bitmap as a variable.

Definition at line 60 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 82 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(), DRW_sparse_uniform_buffer_ensure_item(), edbm_set_normals_from_faces_exec(), editmesh_partial_update_begin_fn(), 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(), blender::bke::make_vertexcos__mapFunc(), UniqueName_Value::mark_used(), mesh_calc_hq_normal(), mesh_island_to_astar_graph_edge_process(), mesh_partial_ensure(), 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(), partial_elem_face_ensure(), partial_elem_vert_ensure(), 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(), UniqueName_Value::use_if_unused(), UniqueName_Value::use_smallest_unused(), 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 96 of file BLI_bitmap.h.

◆ BLI_BITMAP_NEW

#define BLI_BITMAP_NEW ( _num,
_alloc_string )    ((BLI_bitmap *)MEM_callocN(BLI_BITMAP_SIZE(_num), _alloc_string))

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

Definition at line 41 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(), bm_mesh_loops_assign_normal_data(), bm_mesh_loops_split_lnor_fans(), BM_mesh_partial_create_from_verts(), BM_mesh_partial_create_from_verts_group_multi(), BM_mesh_partial_create_from_verts_group_single(), 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(), editmesh_partial_update_begin_fn(), 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(), blender::bke::mesh_get_mapped_verts_coords(), mesh_island_to_astar_graph(), mesh_partial_ensure(), mesh_remove_doubles_on_axis(), MOD_get_texture_coords(), MOD_solidify_extrude_modifyMesh(), blender::ed::object::modifier_skin_armature_create(), multires_mdisps_downsample_hidden(), multires_mdisps_upsample_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)     ((BLI_bitmap *)memset(alloca(BLI_BITMAP_SIZE(_num)), 0, BLI_BITMAP_SIZE(_num)))

Allocate a bitmap on the stack.

Definition at line 47 of file BLI_bitmap.h.

◆ BLI_BITMAP_NEW_MEMARENA

#define BLI_BITMAP_NEW_MEMARENA ( _mem,
_num )
Value:
#define BLI_BITMAP_SIZE(_num)
Definition BLI_bitmap.h:36
#define CHECK_TYPE_INLINE(val, type)
void * BLI_memarena_calloc(struct 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 53 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 118 of file BLI_bitmap.h.

Referenced by DRW_sparse_uniform_buffer_clear(), and DRW_sparse_uniform_buffer_ensure_item().

◆ BLI_BITMAP_SET

◆ BLI_BITMAP_SIZE

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

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

Definition at line 36 of file BLI_bitmap.h.

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

◆ BLI_BITMAP_TEST

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

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

Definition at line 65 of file BLI_bitmap.h.

Referenced by BLI_astar_graph_solve(), BLI_rng_shuffle_bitmap(), BM_lnorspace_invalidate(), BM_loop_normal_editdata_array_init(), bm_loop_normal_mark_indiv_do_loop(), bm_mesh_loops_assign_normal_data(), bm_mesh_loops_split_lnor_fans(), BM_mesh_partial_create_from_verts(), BM_mesh_partial_create_from_verts_group_single(), build_emats_stack(), cage_mapped_verts_callback(), curve_select_less(), curve_select_more(), curve_select_random_exec(), deformVerts_do(), DRW_select_buffer_bitmap_from_poly(), DRW_sparse_uniform_buffer_clear(), DRW_sparse_uniform_buffer_ensure_item(), DRW_sparse_uniform_buffer_flush(), drw_sparse_uniform_buffer_get_ubo(), ED_buttons_tab_has_search_result(), ed_lattice_select_mirrored(), edbm_set_normals_from_faces_exec(), blender::draw::extract_lines_paint_mask_subdiv(), face_edge_loop_islands_calc(), get_vertexcos__mapFunc(), blender::gpu::GLShaderInterface::GLShaderInterface(), gpencil_draw_mask(), gradientVertInit__mapFunc(), lattice_test_bitmap_uvw(), blender::bke::make_vertexcos__mapFunc(), mesh_calc_islands_loop_face_uv(), mesh_island_to_astar_graph(), mesh_partial_ensure(), mesh_remove_doubles_on_axis(), MOD_get_texture_coords(), MOD_solidify_extrude_modifyMesh(), multires_mdisps_downsample_hidden(), multires_mdisps_upsample_hidden(), nladata_flush_channels(), normalEditModifier_do_directional(), normalEditModifier_do_radial(), paint_2d_fill_add_pixel_byte(), paint_2d_fill_add_pixel_float(), partial_elem_face_ensure(), partial_elem_vert_ensure(), property_search_move_to_next_tab_with_results(), similar_vert_select_exec(), blender::ed::object::skin_armature_bone_create(), and blender::ed::object::vgroup_mirror().

◆ BLI_BITMAP_TEST_AND_SET_ATOMIC

#define BLI_BITMAP_TEST_AND_SET_ATOMIC ( _bitmap,
_index )

◆ BLI_BITMAP_TEST_BOOL

#define BLI_BITMAP_TEST_BOOL ( _bitmap,
_index )

Typedef Documentation

◆ BLI_bitmap

typedef unsigned int BLI_bitmap

Definition at line 17 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 36 of file bitmap.c.

References _BITMAP_NUM_BLOCKS.

◆ 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 31 of file bitmap.c.

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 52 of file bitmap.c.

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

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

◆ BLI_bitmap_flip_all()

void BLI_bitmap_flip_all ( BLI_bitmap * bitmap,
size_t bits )

Invert all bits in the bitmap.

Definition at line 23 of file bitmap.c.

References _BITMAP_NUM_BLOCKS.

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 44 of file bitmap.c.

References _BITMAP_NUM_BLOCKS.

◆ BLI_bitmap_set_all()