Fixed red and blue channels being swapped in palette.c
This commit is contained in:
@@ -57,9 +57,9 @@ const char *image_init(image_t *self, const char *filename) {
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < width * height; i++) {
|
for (i = 0; i < width * height; i++) {
|
||||||
unsigned char *p = data32 + i * 4;
|
unsigned char *p = data32 + i * 4;
|
||||||
int b = p[0];
|
int r = p[0];
|
||||||
int g = p[1];
|
int g = p[1];
|
||||||
int r = p[2];
|
int b = p[2];
|
||||||
int a = p[3];
|
int a = p[3];
|
||||||
int idx = palette_colorIdx(r, g, b);
|
int idx = palette_colorIdx(r, g, b);
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ int palette_colorIdx(int r, int g, int b) {
|
|||||||
palette_init();
|
palette_init();
|
||||||
|
|
||||||
/* Make 18bit rgb color (6bits per-channel) from 8bit channels */
|
/* Make 18bit rgb color (6bits per-channel) from 8bit channels */
|
||||||
unsigned color = ((r & 0xfc) << 10) | ((g & 0xfc) << 4) | ((b & 0xfc) >> 2);
|
unsigned color = ((b & 0xfc) << 10) | ((g & 0xfc) << 4) | ((r & 0xfc) >> 2);
|
||||||
|
|
||||||
/* Hash color */
|
/* Hash color */
|
||||||
unsigned h = hash(&color, sizeof(color));
|
unsigned h = hash(&color, sizeof(color));
|
||||||
|
|||||||
Reference in New Issue
Block a user