Re: [AD] Allegro 4.2.0: hsv_to_rgb needless assert

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Elias Pschernig wrote:
On Tue, 2005-12-20 at 13:19 -0600, Robert Jr Ohannessian wrote:

Nevermind - this was fixed in TOT. Too bad it crept into an official release. Now I have to work around it in AGL...



Hum, didn't see it that way yet, but thinking about it now - probably we
should keep the ASSERT in the 4.2 branch. Else, 4.2.1 programs will stop
working with the 4.2.0 debug DLL.. should I revert it?



I'm not sure that it's likely that someone will run a program that was built to use the DEBUG build of the library with an older DEBUG DLL.

Seeing that the ASSERT only does something in the DEBUG version of the library (and even when it does something, it only prints a message), then if somebody develops their code and never uses the DEBUG version of Allegro, they would never know about triggering the assert. So if they assumed that the value would wrap round when outside the range, then if the fmod() goes, then the code will all of a sudden stop working.

Seeing that we want to keep compatibility, we should remove the ASSERT and keep the fmod(). Of course, removing the fmod() would increase the speed at the expense of compatibility, and once we've sacrificed compatibility, we might as well change the units from 0-360 to 0-6 so we can get rid of the /60.0f as well.

However, the docs say that hue is from 0 to 360 and don't explicitly say what happens if the number is outside that range (maybe that's how the ASSERT got in in the first palce - someone just read through the docs when deciding on where to place ASSERTS without reading the code). However, if somebody assumed that there was a wraparound (either through assumption or experimentation), removing the fmod() would break their code.

AE.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/