hint checks to re-alloc as unlikely
also edit comments for knife tool
This commit is contained in:
@@ -153,7 +153,7 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
|
|||||||
/* move the index. */
|
/* move the index. */
|
||||||
gc->cur_tex++;
|
gc->cur_tex++;
|
||||||
|
|
||||||
if (gc->cur_tex >= gc->ntex) {
|
if (UNLIKELY(gc->cur_tex >= gc->ntex)) {
|
||||||
gc->ntex *= 2;
|
gc->ntex *= 2;
|
||||||
gc->textures = (GLuint *)MEM_reallocN((void *)gc->textures, sizeof(GLuint) * gc->ntex);
|
gc->textures = (GLuint *)MEM_reallocN((void *)gc->textures, sizeof(GLuint) * gc->ntex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ static void _ehash_insert(EHash *eh, EHEntry *entry)
|
|||||||
eh->buckets[hash] = entry;
|
eh->buckets[hash] = entry;
|
||||||
eh->numEntries++;
|
eh->numEntries++;
|
||||||
|
|
||||||
if (eh->numEntries > (numBuckets * 3)) {
|
if (UNLIKELY(eh->numEntries > (numBuckets * 3))) {
|
||||||
EHEntry **oldBuckets = eh->buckets;
|
EHEntry **oldBuckets = eh->buckets;
|
||||||
eh->curSize = kHashSizes[++eh->curSizeIdx];
|
eh->curSize = kHashSizes[++eh->curSizeIdx];
|
||||||
|
|
||||||
@@ -1274,7 +1274,7 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
|
|||||||
CCGFace *f = NULL, *fNew;
|
CCGFace *f = NULL, *fNew;
|
||||||
int j, k, topologyChanged = 0;
|
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->lenTempArrays = (numVerts < ss->lenTempArrays * 2) ? ss->lenTempArrays * 2 : numVerts;
|
||||||
ss->tempVerts = MEM_reallocN(ss->tempVerts, sizeof(*ss->tempVerts) * ss->lenTempArrays);
|
ss->tempVerts = MEM_reallocN(ss->tempVerts, sizeof(*ss->tempVerts) * ss->lenTempArrays);
|
||||||
ss->tempEdges = MEM_reallocN(ss->tempEdges, sizeof(*ss->tempEdges) * ss->lenTempArrays);
|
ss->tempEdges = MEM_reallocN(ss->tempEdges, sizeof(*ss->tempEdges) * ss->lenTempArrays);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ static TseGroup *tse_group_create(void)
|
|||||||
|
|
||||||
static void tse_group_add(TseGroup *tse_group, TreeStoreElem *elem)
|
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->allocated *= 2;
|
||||||
tse_group->elems = MEM_reallocN(tse_group->elems, sizeof(TreeStoreElem *) * tse_group->allocated);
|
tse_group->elems = MEM_reallocN(tse_group->elems, sizeof(TreeStoreElem *) * tse_group->allocated);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
/** \file blender/editors/mesh/editmesh_knife.c
|
/** \file blender/editors/mesh/editmesh_knife.c
|
||||||
* \ingroup edmesh
|
* \ingroup edmesh
|
||||||
|
*
|
||||||
|
* Interactive editmesh knife tool.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -71,8 +73,6 @@
|
|||||||
|
|
||||||
#include "mesh_intern.h" /* own include */
|
#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 KMAXDIST 10 /* max mouse distance from edge before not detecting it */
|
||||||
|
|
||||||
#define KNIFE_FLT_EPS 0.00001f
|
#define KNIFE_FLT_EPS 0.00001f
|
||||||
@@ -116,7 +116,7 @@ typedef struct KnifeEdge {
|
|||||||
|
|
||||||
typedef struct KnifeLineHit {
|
typedef struct KnifeLineHit {
|
||||||
float hit[3], cagehit[3];
|
float hit[3], cagehit[3];
|
||||||
float schit[2];
|
float schit[2]; /* screen coordinates for cagehit */
|
||||||
float l; /* lambda along cut line */
|
float l; /* lambda along cut line */
|
||||||
float perc; /* lambda along hit line */
|
float perc; /* lambda along hit line */
|
||||||
float m; /* depth front-to-back */
|
float m; /* depth front-to-back */
|
||||||
|
|||||||
Reference in New Issue
Block a user