Another itch scratched I suppose

This commit is contained in:
XANTRONIX Development 2016-05-15 15:26:30 -05:00
parent 676b4ffa0a
commit 9bac17556d

View file

@ -103,15 +103,12 @@ static inline uint8_t tile_read(cammy_photo *photo, size_t x, size_t y) {
}
static inline void tile_write(cammy_photo *photo,
size_t x, size_t y,
uint8_t r, uint8_t g, uint8_t b) {
size_t x, size_t y, uint8_t value) {
cammy_tile *tile = &photo->tiles[y>>3][x>>3];
int tile_x = x & 7,
tile_y = y & 7;
uint8_t value = rgb_to_tile_2bpp(r, g, b, x, y);
tile->data[ tile_y<<1] |= (value & 0x01) << (tile_x ^ 7);
tile->data[(tile_y<<1)|1] |= ((value & 0x02) >> 1) << (tile_x ^ 7);
}
@ -158,7 +155,7 @@ void cammy_photo_import(cammy_photo *dest, uint8_t *src, int stride) {
buf_read(src, x, y, CAMMY_PHOTO_WIDTH, &r, &g, &b, stride);
tile_write(dest, x, y, r, g, b);
tile_write(dest, x, y, rgb_to_tile_2bpp(r, g, b, x, y));
}
}
}