diff --git a/src/photo.c b/src/photo.c index 62adf02..a5846ee 100644 --- a/src/photo.c +++ b/src/photo.c @@ -83,10 +83,9 @@ void cammy_photo_export(cammy_photo *src, uint8_t *dest, int stride) { int tile_x = x & 7, tile_y = y & 7; - uint8_t value = 0; - - value |= (tile->data[ tile_y<<1] & (8 >> tile_x)) - | ((tile->data[(tile_y<<1)+1] & (8 >> tile_x)) << 1); + uint8_t value = + (tile->data[ tile_y<<1] & (0x80 >> tile_x)) >> (tile_x ^ 7) + | ((tile->data[(tile_y<<1)|1] & (0x80 >> tile_x)) >> (tile_x ^ 7) << 1); value ^= 3;