Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-07-17 21:57:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-07-17 21:57:58 +0300
commit32f7b4a3588f108c7ab4ec733ad4d97738017658 (patch)
treedd77e8159b752c29aeced5c961c0573638a47ec3
parente6711119f217782315f83e8403d4aeca25db2104 (diff)
Avoid getting the original index if its not needed
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 8d91fe8d559..9307abc8a08 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -636,7 +636,7 @@ static void cdDM_drawMappedFaces(
const MPoly *mpoly = cddm->mpoly;
const MLoopCol *mloopcol = NULL;
int colType, useColors = flag & DM_DRAW_USE_COLORS, useHide = flag & DM_DRAW_SKIP_HIDDEN;
- int i, j, orig;
+ int i, j;
int start_element = 0, tot_element, tot_drawn;
int totpoly;
int tottri;
@@ -662,7 +662,7 @@ static void cdDM_drawMappedFaces(
if (fi_map) {
for (i = 0; i < totpoly; i++, mpoly++) {
int selcol = 0xFFFFFFFF;
- orig = (index_mp_to_orig) ? index_mp_to_orig[i] : i;
+ const int orig = (index_mp_to_orig) ? index_mp_to_orig[i] : i;
if ((orig != ORIGINDEX_NONE) && (!useHide || !(me->mpoly[orig].flag & ME_HIDE))) {
WM_framebuffer_index_get(orig + 1, &selcol);
@@ -739,10 +739,13 @@ static void cdDM_drawMappedFaces(
if (i != totpoly - 1)
next_actualFace = bufmat->polys[i + 1];
- orig = (index_mp_to_orig) ? index_mp_to_orig[actualFace] : actualFace;
+ if (setDrawOptions) {
+ const int orig = (index_mp_to_orig) ? index_mp_to_orig[actualFace] : actualFace;
- if (setDrawOptions != NULL && (orig != ORIGINDEX_NONE))
- draw_option = setDrawOptions(userData, orig);
+ if (orig != ORIGINDEX_NONE) {
+ draw_option = setDrawOptions(userData, orig);
+ }
+ }
if (draw_option == DM_DRAW_OPTION_STIPPLE) {
glEnable(GL_POLYGON_STIPPLE);