[Bf-blender-cvs] [f2821e3] master: hint checks to re-alloc as unlikely
Campbell Barton
noreply at git.blender.org
Thu Aug 14 03:09:07 CEST 2014
Commit: f2821e392b3670a094da187d3b16f74568e4a172
Author: Campbell Barton
Date: Thu Aug 14 11:07:33 2014 +1000
Branches: master
https://developer.blender.org/rBf2821e392b3670a094da187d3b16f74568e4a172
hint checks to re-alloc as unlikely
also edit comments for knife tool
===================================================================
M source/blender/blenfont/intern/blf_glyph.c
M source/blender/blenkernel/intern/CCGSubSurf.c
M source/blender/blenkernel/intern/treehash.c
M source/blender/editors/mesh/editmesh_knife.c
===================================================================
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index bfb42f6..a2462f3 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -153,7 +153,7 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
/* move the index. */
gc->cur_tex++;
- if (gc->cur_tex >= gc->ntex) {
+ if (UNLIKELY(gc->cur_tex >= gc->ntex)) {
gc->ntex *= 2;
gc->textures = (GLuint *)MEM_reallocN((void *)gc->textures, sizeof(GLuint) * gc->ntex);
}
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 6cda0a1..623fb50 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -119,7 +119,7 @@ static void _ehash_insert(EHash *eh, EHEntry *entry)
eh->buckets[hash] = entry;
eh->numEntries++;
- if (eh->numEntries > (numBuckets * 3)) {
+ if (UNLIKELY(eh->numEntries > (numBuckets * 3))) {
EHEntry **oldBuckets = eh->buckets;
eh->curSize = kHashSizes[++eh->curSizeIdx];
@@ -1274,7 +1274,7 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
CCGFace *f = NULL, *fNew;
int j, k, topologyChanged = 0;
- if (numVerts > ss->lenTempArrays) {
+ if (UNLIKELY(numVerts > ss->lenTempArrays)) {
ss->lenTempArrays = (numVerts < ss->lenTempArrays * 2) ? ss->lenTempArrays * 2 : numVerts;
ss->tempVerts = MEM_reallocN(ss->tempVerts, sizeof(*ss->tempVerts) * ss->lenTempArrays);
ss->tempEdges = MEM_reallocN(ss->tempEdges, sizeof(*ss->tempEdges) * ss->lenTempArrays);
diff --git a/source/blender/blenkernel/intern/treehash.c b/source/blender/blenkernel/intern/treehash.c
index fb55e3d..a65bd28 100644
--- a/source/blender/blenkernel/intern/treehash.c
+++ b/source/blender/blenkernel/intern/treehash.c
@@ -59,7 +59,7 @@ static TseGroup *tse_group_create(void)
static void tse_group_add(TseGroup *tse_group, TreeStoreElem *elem)
{
- if (tse_group->size == tse_group->allocated) {
+ if (UNLIKELY(tse_group->size == tse_group->allocated)) {
tse_group->allocated *= 2;
tse_group->elems = MEM_reallocN(tse_group->elems, sizeof(TreeStoreElem *) * tse_group->allocated);
}
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index e355b4e..609f018 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -27,6 +27,8 @@
/** \file blender/editors/mesh/editmesh_knife.c
* \ingroup edmesh
+ *
+ * Interactive editmesh knife tool.
*/
#ifdef _MSC_VER
@@ -71,8 +73,6 @@
#include "mesh_intern.h" /* own include */
-/* this code here is kindof messy. . .I might need to eventually rework it - joeedh */
-
#define KMAXDIST 10 /* max mouse distance from edge before not detecting it */
#define KNIFE_FLT_EPS 0.00001f
@@ -116,7 +116,7 @@ typedef struct KnifeEdge {
typedef struct KnifeLineHit {
float hit[3], cagehit[3];
- float schit[2];
+ float schit[2]; /* screen coordinates for cagehit */
float l; /* lambda along cut line */
float perc; /* lambda along hit line */
float m; /* depth front-to-back */
More information about the Bf-blender-cvs
mailing list