OSDN Git Service

[fixed] Color.toFloatBits() methods. Will half the precision of the alpha channel...
authorbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sun, 28 Nov 2010 14:27:23 +0000 (14:27 +0000)
committerbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sun, 28 Nov 2010 14:27:23 +0000 (14:27 +0000)
commitd4abbe37d24b15bc002033ce15bb942a39133de2
tree7def68429746ba7f2d378cf6d71e273d2e43108b
parentddf3cfdb3c325224d2fbf9f30793bd6e57110dfa
[fixed] Color.toFloatBits() methods. Will half the precision of the alpha channel of 32-bit rgba colors. Nothing i can do about it. Problem is that Java only has a single canonical NaN value. Using Float.intBitsToFloat() will convert any signaling NaN to that canonical value, transforming colors like 0xfeaaeb3c to 0xfeeaeb3c. The fix just masks the 32-bit int via 0xfeffffff before it is passed ot Color.toFloatBits() effectively making it impossible to return canonical NaNs. This of course means that the least significant bit of the alpha component is always 0, so you only have 128 alpha values really :p. Darn Java. Darn FPUs.
gdx/src/com/badlogic/gdx/graphics/Color.java