Fix dithering stupidity in cammy_image_dither()
This commit is contained in:
parent
180b36203b
commit
d18c319c89
1 changed files with 9 additions and 3 deletions
12
src/photo.c
12
src/photo.c
|
@ -140,6 +140,10 @@ void cammy_photo_dither(uint8_t *dest,
|
|||
int width,
|
||||
int height,
|
||||
int stride) {
|
||||
static uint8_t values[4] = {
|
||||
0, 86, 171, 255
|
||||
};
|
||||
|
||||
size_t x, y;
|
||||
|
||||
for (y=0; y<height; y++) {
|
||||
|
@ -164,9 +168,11 @@ void cammy_photo_dither(uint8_t *dest,
|
|||
value = from ^ 0x03;
|
||||
}
|
||||
|
||||
dest[stride*CAMMY_PHOTO_WIDTH*y+stride*x] = value;
|
||||
dest[stride*CAMMY_PHOTO_WIDTH*y+stride*x+1] = value;
|
||||
dest[stride*CAMMY_PHOTO_WIDTH*y+stride*x+2] = value;
|
||||
value ^= 3;
|
||||
|
||||
dest[stride*width*y+stride*x] = values[value];
|
||||
dest[stride*width*y+stride*x+1] = values[value];
|
||||
dest[stride*width*y+stride*x+2] = values[value];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue