Closed DrMaxNix closed 1 year ago
I you're right then It's a race condition I would opt in for a mutex instead I'm currently tired and I have an headache so I don't think I could do something right now
d5f8dc5 Please test using this commit
d5f8dc5 Please test using this commit
Not working. It's still placing wrong colors. I'm using 24-bitmap .bmp file saved from Paint app, unsure if that's the cause or not.
This hopefully solves the problem with the wrong colors. (fixes #28)
Cause
The function
closestColor()
uses the variablec
to iterate over all available colors. When it found a color that is closer than the previous best, it setsclosestColor
to a pointer toc
. In the end it returnsclosestColor
which still is a pointer toc
. Problem is:c
has changed by then and always has the value of the last item in the list of colors that was checked.