forked from bartvdbraak/blender
Mingw Compiling Fix - Conversion from int to unsigned char...
Apparently mingw/gcc is too stupid to recognise that the values in alphatest will only be used if they're within the range of unsigned char (i.e. 0 <= x < 255) when this is done using a ternary operator. Then again, it's quite hard for humans to immediately parse what is going on here either! Converting this clever code back to a more obvious form that mere mortals (and compilers it seems) can handle with ease ;)
This commit is contained in:
parent
33c68846de
commit
7176cbf466
@ -376,15 +376,27 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
|||||||
cbuf[0] = b_col_char[0];
|
cbuf[0] = b_col_char[0];
|
||||||
cbuf[1] = b_col_char[1];
|
cbuf[1] = b_col_char[1];
|
||||||
cbuf[2] = b_col_char[2];
|
cbuf[2] = b_col_char[2];
|
||||||
cbuf[3] = (alphatest = ((int)cbuf[3] + (int)b_col_char[3])) < 255 ?
|
|
||||||
(unsigned char)(alphatest) : 255;
|
alphatest = (int)cbuf[3] + (int)b_col_char[3];
|
||||||
|
if (alphatest < 255) {
|
||||||
|
cbuf[3] = (unsigned char)(alphatest);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cbuf[3] = 255;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cbuf[0] = (unsigned char)((b_col_char[0] * a) + (cbuf[0] * (1.0f - a)));
|
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[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[2] = (unsigned char)((b_col_char[2] * a) + (cbuf[2] * (1.0f - a)));
|
||||||
cbuf[3] = (alphatest = ((int)cbuf[3] + (int)((b_col_float[3] * a) * 255.0f))) < 255 ?
|
|
||||||
(unsigned char)(alphatest) : 255;
|
alphatest = ((int)cbuf[3] + (int)((b_col_float[3] * a) * 255.0f));
|
||||||
|
if (alphatest < 255) {
|
||||||
|
cbuf[3] = (unsigned char)(alphatest);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cbuf[3] = 255;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user