forked from bartvdbraak/blender
avoid double ghash lookup in sculpt map_insert_vert
This commit is contained in:
parent
4b1fc0593e
commit
2c556c2ef7
@ -245,9 +245,13 @@ static int map_insert_vert(PBVH *bvh, GHash *map,
|
||||
unsigned int *face_verts,
|
||||
unsigned int *uniq_verts, int vertex)
|
||||
{
|
||||
void *value, *key = SET_INT_IN_POINTER(vertex);
|
||||
void *key, **value_p;
|
||||
|
||||
if (!BLI_ghash_haskey(map, key)) {
|
||||
key = SET_INT_IN_POINTER(vertex);
|
||||
value_p = BLI_ghash_lookup_p(map, key);
|
||||
|
||||
if (value_p == NULL) {
|
||||
void *value;
|
||||
if (BLI_BITMAP_GET(bvh->vert_bitmap, vertex)) {
|
||||
value = SET_INT_IN_POINTER(~(*face_verts));
|
||||
++(*face_verts);
|
||||
@ -261,8 +265,9 @@ static int map_insert_vert(PBVH *bvh, GHash *map,
|
||||
BLI_ghash_insert(map, key, value);
|
||||
return GET_INT_FROM_POINTER(value);
|
||||
}
|
||||
else
|
||||
return GET_INT_FROM_POINTER(BLI_ghash_lookup(map, key));
|
||||
else {
|
||||
return GET_INT_FROM_POINTER(*value_p);
|
||||
}
|
||||
}
|
||||
|
||||
/* Find vertices used by the faces in this node and update the draw buffers */
|
||||
|
Loading…
Reference in New Issue
Block a user