remove the pointer from BLI_bitmap's typedef,

hides that an arg passed is really an array which may be modified by other functions.
This commit is contained in:
Campbell Barton 2013-07-22 23:20:48 +00:00
parent b7bf20d950
commit 04ea8c0ee8
17 changed files with 58 additions and 58 deletions

View File

@ -223,7 +223,7 @@ typedef struct PBVHVertexIter {
struct CCGElem **grids;
struct CCGElem *grid;
struct CCGKey *key;
BLI_bitmap *grid_hidden, gh;
BLI_bitmap **grid_hidden, *gh;
int *grid_indices;
int totgrid;
int gridsize;

View File

@ -2190,7 +2190,7 @@ void BKE_editmesh_statvis_calc(BMEditMesh *em, DerivedMesh *dm,
struct CageUserData {
int totvert;
float (*cos_cage)[3];
BLI_bitmap visit_bitmap;
BLI_bitmap *visit_bitmap;
};
static void cage_mapped_verts_callback(void *userData, int index, const float co[3],
@ -2207,7 +2207,7 @@ static void cage_mapped_verts_callback(void *userData, int index, const float co
float (*BKE_editmesh_vertexCos_get(BMEditMesh *em, Scene *scene, int *r_numVerts))[3]
{
DerivedMesh *cage, *final;
BLI_bitmap visit_bitmap;
BLI_bitmap *visit_bitmap;
struct CageUserData data;
float (*cos_cage)[3];

View File

@ -105,15 +105,15 @@ void multires_customdata_delete(Mesh *me)
}
/** Grid hiding **/
static BLI_bitmap multires_mdisps_upsample_hidden(BLI_bitmap lo_hidden,
int lo_level,
int hi_level,
static BLI_bitmap *multires_mdisps_upsample_hidden(BLI_bitmap *lo_hidden,
int lo_level,
int hi_level,
/* assumed to be at hi_level (or
* null) */
BLI_bitmap prev_hidden)
/* assumed to be at hi_level (or
* null) */
BLI_bitmap *prev_hidden)
{
BLI_bitmap subd;
BLI_bitmap *subd;
int hi_gridsize = ccg_gridsize(hi_level);
int lo_gridsize = ccg_gridsize(lo_level);
int yh, xh, xl, yl, xo, yo, hi_ndx;
@ -168,11 +168,11 @@ static BLI_bitmap multires_mdisps_upsample_hidden(BLI_bitmap lo_hidden,
return subd;
}
static BLI_bitmap multires_mdisps_downsample_hidden(BLI_bitmap old_hidden,
int old_level,
int new_level)
static BLI_bitmap *multires_mdisps_downsample_hidden(BLI_bitmap *old_hidden,
int old_level,
int new_level)
{
BLI_bitmap new_hidden;
BLI_bitmap *new_hidden;
int new_gridsize = ccg_gridsize(new_level);
int old_gridsize = ccg_gridsize(old_level);
int x, y, factor, old_value;
@ -200,7 +200,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm,
Mesh *me, int level)
{
const MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
BLI_bitmap *grid_hidden = ccgdm->gridHidden;
BLI_bitmap **grid_hidden = ccgdm->gridHidden;
int *gridOffset;
int i, j;
@ -210,7 +210,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm,
for (j = 0; j < me->mpoly[i].totloop; j++) {
int g = gridOffset[i] + j;
const MDisps *md = &mdisps[g];
BLI_bitmap gh = md->hidden;
BLI_bitmap *gh = md->hidden;
if (gh) {
grid_hidden[g] =
@ -224,7 +224,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm,
* the current level of md.hidden) */
static void multires_mdisps_subdivide_hidden(MDisps *md, int new_level)
{
BLI_bitmap subd;
BLI_bitmap *subd;
BLI_assert(md->hidden);
@ -647,7 +647,7 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
multires_copy_grid(ndisps, hdisps, nsize, hsize);
if (mdisp->hidden) {
BLI_bitmap gh =
BLI_bitmap *gh =
multires_mdisps_downsample_hidden(mdisp->hidden,
mdisp->level,
lvl);
@ -1251,7 +1251,7 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
void multires_modifier_update_hidden(DerivedMesh *dm)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
BLI_bitmap *grid_hidden = ccgdm->gridHidden;
BLI_bitmap **grid_hidden = ccgdm->gridHidden;
Mesh *me = ccgdm->multires.ob->data;
MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
int totlvl = ccgdm->multires.totlvl;
@ -1262,7 +1262,7 @@ void multires_modifier_update_hidden(DerivedMesh *dm)
for (i = 0; i < me->totloop; i++) {
MDisps *md = &mdisps[i];
BLI_bitmap gh = grid_hidden[i];
BLI_bitmap *gh = grid_hidden[i];
if (!gh && md->hidden) {
MEM_freeN(md->hidden);

View File

@ -538,7 +538,7 @@ void BKE_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
/* Do a full rebuild with on Grids data structure */
void BKE_pbvh_build_grids(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj,
int totgrid, CCGKey *key, void **gridfaces, DMFlagMat *flagmats, BLI_bitmap *grid_hidden)
int totgrid, CCGKey *key, void **gridfaces, DMFlagMat *flagmats, BLI_bitmap **grid_hidden)
{
BBC *prim_bbc = NULL;
BB cb;
@ -1253,7 +1253,7 @@ void BKE_pbvh_bounding_box(const PBVH *bvh, float min[3], float max[3])
}
}
BLI_bitmap *BKE_pbvh_grid_hidden(const PBVH *bvh)
BLI_bitmap **BKE_pbvh_grid_hidden(const PBVH *bvh)
{
BLI_assert(bvh->type == PBVH_GRIDS);
return bvh->grid_hidden;
@ -1469,7 +1469,7 @@ static int pbvh_grids_node_raycast(PBVH *bvh, PBVHNode *node,
for (i = 0; i < totgrid; ++i) {
CCGElem *grid = bvh->grids[node->prim_indices[i]];
BLI_bitmap gh;
BLI_bitmap *gh;
if (!grid)
continue;
@ -1664,7 +1664,7 @@ void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
}
void BKE_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, void **gridfaces,
DMFlagMat *flagmats, BLI_bitmap *grid_hidden)
DMFlagMat *flagmats, BLI_bitmap **grid_hidden)
{
int a;

View File

@ -139,11 +139,11 @@ struct PBVH {
void **gridfaces;
const DMFlagMat *grid_flag_mats;
int totgrid;
BLI_bitmap *grid_hidden;
BLI_bitmap **grid_hidden;
/* Only used during BVH build and update,
* don't need to remain valid after */
BLI_bitmap vert_bitmap;
BLI_bitmap *vert_bitmap;
#ifdef PERFCNTRS
int perf_modified;

View File

@ -2930,7 +2930,7 @@ static void ccgdm_create_grids(DerivedMesh *dm)
gridFaces = MEM_mallocN(sizeof(CCGFace *) * numGrids, "ccgdm.gridFaces");
gridFlagMats = MEM_mallocN(sizeof(DMFlagMat) * numGrids, "ccgdm.gridFlagMats");
ccgdm->gridHidden = MEM_callocN(sizeof(BLI_bitmap) * numGrids, "ccgdm.gridHidden");
ccgdm->gridHidden = MEM_callocN(sizeof(*ccgdm->gridHidden) * numGrids, "ccgdm.gridHidden");
for (gIndex = 0, index = 0; index < numFaces; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
@ -3002,7 +3002,7 @@ static DMFlagMat *ccgDM_getGridFlagMats(DerivedMesh *dm)
return ccgdm->gridFlagMats;
}
static BLI_bitmap *ccgDM_getGridHidden(DerivedMesh *dm)
static BLI_bitmap **ccgDM_getGridHidden(DerivedMesh *dm)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;

View File

@ -26,7 +26,7 @@
#ifndef __BLI_BITMAP_H__
#define __BLI_BITMAP_H__
typedef unsigned int *BLI_bitmap;
typedef unsigned int BLI_bitmap;
/* warning: the bitmap does not keep track of its own size or check
* for out-of-bounds access */
@ -48,7 +48,7 @@ typedef unsigned int *BLI_bitmap;
/* allocate memory for a bitmap with '_tot' bits; free
* with MEM_freeN() */
#define BLI_BITMAP_NEW(_tot, _alloc_string) \
((BLI_bitmap)MEM_callocN(BLI_BITMAP_SIZE(_tot), \
((BLI_bitmap *)MEM_callocN(BLI_BITMAP_SIZE(_tot), \
_alloc_string))
/* get the value of a single bit at '_index' */

View File

@ -5174,7 +5174,7 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
/* may not be optimal always (example: end of NURBS sphere) */
if (obedit->type == OB_SURF) {
for (nu = editnurb->first; nu; nu = nu->next) {
BLI_bitmap selbpoints;
BLI_bitmap *selbpoints;
a = nu->pntsu * nu->pntsv;
bp = nu->bp;
selbpoints = BLI_BITMAP_NEW(a, "selectlist");
@ -5260,7 +5260,7 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
if (obedit->type == OB_SURF) {
for (nu = editnurb->first; nu; nu = nu->next) {
BLI_bitmap selbpoints;
BLI_bitmap *selbpoints;
a = nu->pntsu * nu->pntsv;
bp = nu->bp;
selbpoints = BLI_BITMAP_NEW(a, "selectlist");

View File

@ -198,8 +198,8 @@ static void select_linked_tfaces_with_seams(Mesh *me, const unsigned int index,
bool do_it = true;
bool mark = false;
BLI_bitmap edge_tag = BLI_BITMAP_NEW(me->totedge, __func__);
BLI_bitmap poly_tag = BLI_BITMAP_NEW(me->totpoly, __func__);
BLI_bitmap *edge_tag = BLI_BITMAP_NEW(me->totedge, __func__);
BLI_bitmap *poly_tag = BLI_BITMAP_NEW(me->totpoly, __func__);
if (index != (unsigned int)-1) {
/* only put face under cursor in array */

View File

@ -228,7 +228,7 @@ void LATTICE_OT_select_random(wmOperatorType *ot)
/************************** Select More/Less Operator *************************/
static bool lattice_test_bitmap_uvw(Lattice *lt, BLI_bitmap selpoints, int u, int v, int w, const bool selected)
static bool lattice_test_bitmap_uvw(Lattice *lt, BLI_bitmap *selpoints, int u, int v, int w, const bool selected)
{
if ((u < 0 || u >= lt->pntsu) ||
(v < 0 || v >= lt->pntsv) ||
@ -252,7 +252,7 @@ static int lattice_select_more_less(bContext *C, const bool select)
BPoint *bp;
const int tot = lt->pntsu * lt->pntsv * lt->pntsw;
int i, w, u, v;
BLI_bitmap selpoints;
BLI_bitmap *selpoints;
lt->actbp = LT_ACTBP_NONE;

View File

@ -1671,7 +1671,7 @@ void OBJECT_OT_skin_radii_equalize(wmOperatorType *ot)
static void skin_armature_bone_create(Object *skin_ob,
MVert *mvert, MEdge *medge,
bArmature *arm,
BLI_bitmap edges_visited,
BLI_bitmap *edges_visited,
const MeshElemMap *emap,
EditBone *parent_bone,
int parent_v)
@ -1720,7 +1720,7 @@ static void skin_armature_bone_create(Object *skin_ob,
static Object *modifier_skin_armature_create(Main *bmain, Scene *scene, Object *skin_ob)
{
BLI_bitmap edges_visited;
BLI_bitmap *edges_visited;
DerivedMesh *deform_dm;
MVert *mvert;
Mesh *me = skin_ob->data;

View File

@ -154,7 +154,7 @@ static void partialvis_update_grids(Object *ob,
{
CCGElem **grids;
CCGKey key;
BLI_bitmap *grid_hidden;
BLI_bitmap **grid_hidden;
int any_visible = 0;
int *grid_indices, totgrid, any_changed, i;
@ -171,7 +171,7 @@ static void partialvis_update_grids(Object *ob,
for (i = 0; i < totgrid; i++) {
int any_hidden = 0;
int g = grid_indices[i], x, y;
BLI_bitmap gh = grid_hidden[g];
BLI_bitmap *gh = grid_hidden[g];
if (!gh) {
switch (action) {

View File

@ -1529,7 +1529,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
float *tmpgrid_mask, *tmprow_mask;
int v1, v2, v3, v4;
int thread_num;
BLI_bitmap *grid_hidden;
BLI_bitmap **grid_hidden;
int *grid_indices, totgrid, gridsize, i, x, y;
sculpt_brush_test_init(ss, &test);
@ -1554,7 +1554,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
for (i = 0; i < totgrid; ++i) {
int gi = grid_indices[i];
BLI_bitmap gh = grid_hidden[gi];
BLI_bitmap *gh = grid_hidden[gi];
data = griddata[gi];
adj = &gridadj[gi];

View File

@ -100,14 +100,14 @@ typedef struct SculptUndoNode {
/* non-multires */
int maxvert; /* to verify if totvert it still the same */
int *index; /* to restore into right location */
BLI_bitmap vert_hidden;
BLI_bitmap *vert_hidden;
/* multires */
int maxgrid; /* same for grid */
int gridsize; /* same for grid */
int totgrid; /* to restore into right location */
int *grids; /* to restore into right location */
BLI_bitmap *grid_hidden;
BLI_bitmap **grid_hidden;
/* bmesh */
struct BMLogEntry *bm_entry;

View File

@ -210,10 +210,10 @@ static int sculpt_undo_restore_hidden(bContext *C, DerivedMesh *dm,
}
}
else if (unode->maxgrid && dm->getGridData) {
BLI_bitmap *grid_hidden = dm->getGridHidden(dm);
BLI_bitmap **grid_hidden = dm->getGridHidden(dm);
for (i = 0; i < unode->totgrid; i++) {
SWAP(BLI_bitmap,
SWAP(BLI_bitmap *,
unode->grid_hidden[i],
grid_hidden[unode->grids[i]]);
@ -531,7 +531,7 @@ static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh,
SculptUndoNode *unode)
{
PBVHNode *node = unode->node;
BLI_bitmap *grid_hidden;
BLI_bitmap **grid_hidden;
int i, *grid_indices, totgrid;
grid_hidden = BKE_pbvh_grid_hidden(pbvh);
@ -539,7 +539,7 @@ static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh,
BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid,
NULL, NULL, NULL, NULL);
unode->grid_hidden = MEM_mapallocN(sizeof(BLI_bitmap) * totgrid,
unode->grid_hidden = MEM_mapallocN(sizeof(*unode->grid_hidden) * totgrid,
"unode->grid_hidden");
for (i = 0; i < totgrid; i++) {

View File

@ -77,7 +77,7 @@
/* user data structures for derived mesh callbacks */
typedef struct drawMeshFaceSelect_userData {
Mesh *me;
BLI_bitmap edge_flags; /* pairs of edge options (visible, select) */
BLI_bitmap *edge_flags; /* pairs of edge options (visible, select) */
} drawMeshFaceSelect_userData;
typedef struct drawEMTFMapped_userData {
@ -100,9 +100,9 @@ typedef struct drawTFace_userData {
BLI_INLINE int edge_vis_index(const int index) { return index * 2; }
BLI_INLINE int edge_sel_index(const int index) { return index * 2 + 1; }
static BLI_bitmap get_tface_mesh_marked_edge_info(Mesh *me)
static BLI_bitmap *get_tface_mesh_marked_edge_info(Mesh *me)
{
BLI_bitmap bitmap_edge_flags = BLI_BITMAP_NEW(me->totedge * 2, __func__);
BLI_bitmap *bitmap_edge_flags = BLI_BITMAP_NEW(me->totedge * 2, __func__);
MPoly *mp;
MLoop *ml;
int i, j;

View File

@ -1266,7 +1266,7 @@ struct GPU_Buffers {
CCGKey gridkey;
CCGElem **grids;
const DMFlagMat *grid_flag_mats;
const BLI_bitmap *grid_hidden;
BLI_bitmap * const *grid_hidden;
int *grid_indices;
int totgrid;
int has_hidden;
@ -1686,7 +1686,7 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, CCGElem **grids,
}
/* Returns the number of visible quads in the nodes' grids. */
static int gpu_count_grid_quads(BLI_bitmap *grid_hidden,
static int gpu_count_grid_quads(BLI_bitmap **grid_hidden,
int *grid_indices, int totgrid,
int gridsize)
{
@ -1697,7 +1697,7 @@ static int gpu_count_grid_quads(BLI_bitmap *grid_hidden,
* visibility */
for (i = 0, totquad = 0; i < totgrid; i++) {
const BLI_bitmap gh = grid_hidden[grid_indices[i]];
const BLI_bitmap *gh = grid_hidden[grid_indices[i]];
if (gh) {
/* grid hidden are present, have to check each element */
@ -1732,7 +1732,7 @@ static int gpu_count_grid_quads(BLI_bitmap *grid_hidden,
GL_WRITE_ONLY_ARB); \
if (quad_data) { \
for (i = 0; i < totgrid; ++i) { \
BLI_bitmap gh = NULL; \
BLI_bitmap *gh = NULL; \
if (grid_hidden) \
gh = grid_hidden[(grid_indices)[i]]; \
\
@ -1770,7 +1770,7 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to
static unsigned prev_totquad;
/* used in the FILL_QUAD_BUFFER macro */
const BLI_bitmap *grid_hidden = NULL;
BLI_bitmap * const *grid_hidden = NULL;
int *grid_indices = NULL;
int totgrid = 1;
@ -1815,7 +1815,7 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to
}
GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid,
BLI_bitmap *grid_hidden, int gridsize)
BLI_bitmap **grid_hidden, int gridsize)
{
GPU_Buffers *buffers;
int totquad;
@ -2200,7 +2200,7 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers)
for (i = 0; i < buffers->totgrid; ++i) {
int g = buffers->grid_indices[i];
CCGElem *grid = buffers->grids[g];
BLI_bitmap gh = buffers->grid_hidden[g];
BLI_bitmap *gh = buffers->grid_hidden[g];
/* TODO: could use strips with hiding as well */