fix confusing operator precedence

Assigning within a conditional is confusing and error prone so I
rewrote in a more straightforward way.

Found with PVS-Studio T48917
This commit is contained in:
Mike Erwin 2016-07-21 18:52:44 -04:00
parent 9ff8d4a957
commit 08e1bba10c
Notes: blender-bot 2023-02-14 10:21:11 +01:00
Referenced by issue #49000, Cycles - Baking - Crashes with many lights
Referenced by issue #48930, not influenced snap points of the same mesh are ignored with proportional editing set on connected
Referenced by issue #48925, 'vertex connect' error
Referenced by issue #48929, autosave doesn't save like normal save
1 changed files with 2 additions and 6 deletions

View File

@ -370,12 +370,10 @@ static void blf_font_draw_buffer_ex(
fbuf[3] = 1.0f;
}
else {
float alphatest;
fbuf[0] = (b_col_float[0] * a) + (fbuf[0] * (1.0f - a));
fbuf[1] = (b_col_float[1] * a) + (fbuf[1] * (1.0f - a));
fbuf[2] = (b_col_float[2] * a) + (fbuf[2] * (1.0f - a));
fbuf[3] = (alphatest = (fbuf[3] + a)) < 1.0f ?
alphatest : 1.0f;
fbuf[3] = MIN2(fbuf[3] + a, 1.0f); /* clamp to 1.0 */
}
}
}
@ -407,12 +405,10 @@ static void blf_font_draw_buffer_ex(
cbuf[3] = 255;
}
else {
int alphatest;
cbuf[0] = (unsigned char)((b_col_char[0] * a) + (cbuf[0] * (1.0f - a)));
cbuf[1] = (unsigned char)((b_col_char[1] * a) + (cbuf[1] * (1.0f - a)));
cbuf[2] = (unsigned char)((b_col_char[2] * a) + (cbuf[2] * (1.0f - a)));
cbuf[3] = (unsigned char)(((alphatest = ((int)cbuf[3] + (int)(a * 255))) < 255) ?
alphatest : 255);
cbuf[3] = (unsigned char)MIN2((int)cbuf[3] + (int)(a * 255), 255); /* clamp to 255 */
}
}
}