revision 200:c3bdcd373b6d
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 200:c3bdcd373b6d |
parent | 199:4433d9c1638c |
child | 201:65183b9b0641 |
author | nkeynes |
date | Sun Aug 06 04:01:37 2006 +0000 (17 years ago) |
Fix parse_float_colour for values <= 0 and qNaN
src/pvr2/tacore.c | view | annotate | diff | log |
1.1 --- a/src/pvr2/tacore.c Sun Aug 06 03:50:36 2006 +00001.2 +++ b/src/pvr2/tacore.c Sun Aug 06 04:01:37 2006 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: tacore.c,v 1.5 2006-08-06 03:50:36 nkeynes Exp $1.6 + * $Id: tacore.c,v 1.6 2006-08-06 04:01:37 nkeynes Exp $1.7 *1.8 * PVR2 Tile Accelerator implementation1.9 *1.10 @@ -213,11 +213,33 @@1.11 }1.13 static uint32_t parse_float_colour( float a, float r, float g, float b ) {1.14 - return1.15 - (((unsigned int)((256 * CLAMP(a,0.0,1.0))-1))<<24) |1.16 - (((unsigned int)((256 * CLAMP(r,0.0,1.0))-1))<<16) |1.17 - (((unsigned int)((256 * CLAMP(g,0.0,1.0))-1))<<8) |1.18 - (((unsigned int)((256 * CLAMP(b,0.0,1.0))-1)));1.19 + int ai,ri,gi,bi;1.20 +1.21 + if( TA_IS_INF(a) ) {1.22 + ai = 255;1.23 + } else {1.24 + ai = 256 * CLAMP(a,0.0,1.0) - 1;1.25 + if( ai < 0 ) ai = 0;1.26 + }1.27 + if( TA_IS_INF(r) ) {1.28 + ri = 255;1.29 + } else {1.30 + ri = 256 * CLAMP(r,0.0,1.0) - 1;1.31 + if( ri < 0 ) ri = 0;1.32 + }1.33 + if( TA_IS_INF(g) ) {1.34 + gi = 255;1.35 + } else {1.36 + gi = 256 * CLAMP(g,0.0,1.0) - 1;1.37 + if( gi < 0 ) gi = 0;1.38 + }1.39 + if( TA_IS_INF(b) ) {1.40 + bi = 255;1.41 + } else {1.42 + bi = 256 * CLAMP(b,0.0,1.0) - 1;1.43 + if( bi < 0 ) bi = 0;1.44 + }1.45 + return (ai << 24) | (ri << 16) | (gi << 8) | bi;1.46 }1.48 static uint32_t parse_intensity_colour( uint32_t base, float intensity )
.