[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52881] trunk/blender/source/blender/bmesh /intern/bmesh_mods.c: minor speedup - replace use of smallhash with api_flags for BM_edge_split( )

Campbell Barton ideasman42 at gmail.com
Tue Dec 11 15:30:12 CET 2012


Revision: 52881
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52881
Author:   campbellbarton
Date:     2012-12-11 14:30:12 +0000 (Tue, 11 Dec 2012)
Log Message:
-----------
minor speedup - replace use of smallhash with api_flags for BM_edge_split()

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/intern/bmesh_mods.c

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_mods.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_mods.c	2012-12-11 14:29:01 UTC (rev 52880)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_mods.c	2012-12-11 14:30:12 UTC (rev 52881)
@@ -641,7 +641,6 @@
 	BMFace **oldfaces = NULL;
 	BMEdge *e_dummy;
 	BLI_array_staticdeclare(oldfaces, 32);
-	SmallHash hash;
 	const int do_mdisp = (e->l && CustomData_has_layer(&bm->ldata, CD_MDISPS));
 
 	/* we need this for handling multi-res */
@@ -660,12 +659,11 @@
 			l = l->radial_next;
 		} while (l != e->l);
 		
-		/* create a hash so we can differentiate oldfaces from new face */
-		BLI_smallhash_init(&hash);
-		
+		/* flag existing faces so we can differentiate oldfaces from new faces */
 		for (i = 0; i < BLI_array_count(oldfaces); i++) {
+			BM_ELEM_API_FLAG_ENABLE(oldfaces[i], _FLAG_OVERLAP);
 			oldfaces[i] = BM_face_copy(bm, oldfaces[i], TRUE, TRUE);
-			BLI_smallhash_insert(&hash, (intptr_t)oldfaces[i], NULL);
+			BM_ELEM_API_FLAG_DISABLE(oldfaces[i], _FLAG_OVERLAP);
 		}
 	}
 
@@ -703,7 +701,8 @@
 				}
 				
 				do {
-					if (!BLI_smallhash_haskey(&hash, (intptr_t)l->f)) {
+					/* check this is an old face */
+					if (BM_ELEM_API_FLAG_TEST(l->f, _FLAG_OVERLAP)) {
 						BMLoop *l2_first;
 
 						l2 = l2_first = BM_FACE_FIRST_LOOP(l->f);
@@ -741,7 +740,6 @@
 #endif
 		
 		BLI_array_free(oldfaces);
-		BLI_smallhash_release(&hash);
 	}
 
 	return nv;




More information about the Bf-blender-cvs mailing list