Hopefully fix color conversion.
Hard to tell because the triangle rendering is still messed up. However, storing negative values in bytes doesn't work :)
This commit is contained in:
parent
be9c0697a2
commit
d41bf32d91
|
@ -83,12 +83,12 @@ static byte
|
||||||
convert_color (byte *rgb)
|
convert_color (byte *rgb)
|
||||||
{
|
{
|
||||||
//FIXME slow!
|
//FIXME slow!
|
||||||
byte dist[3];
|
int dist[3];
|
||||||
int d, bestd = 256 * 256 * 3, bestc = -1;
|
int d, bestd = 256 * 256 * 3, bestc = -1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
VectorSubtract (vid.basepal, rgb, dist);
|
VectorSubtract (vid.basepal + i * 3, rgb, dist);
|
||||||
d = DotProduct (dist, dist);
|
d = DotProduct (dist, dist);
|
||||||
if (d < bestd) {
|
if (d < bestd) {
|
||||||
bestd = d;
|
bestd = d;
|
||||||
|
|
Loading…
Reference in New Issue