BYTES_PER_PIXEL 3 -> 4

This commit is contained in:
uobikiemukot 2014-08-12 15:46:22 +09:00
parent abdb7b98bb
commit dd6b660856
2 changed files with 7 additions and 3 deletions

8
dcs.h
View file

@ -6,17 +6,19 @@ enum {
LSMAX = 100,
};
/*
static inline void split_rgb(uint32_t color, uint8_t *r, uint8_t *g, uint8_t *b)
{
*r = bit_mask[8] & (color >> 16);
*g = bit_mask[8] & (color >> 8);
*b = bit_mask[8] & (color >> 0);
}
*/
static inline int sixel_bitmap(struct terminal *term, struct sixel_canvas_t *sc, uint8_t bitmap)
{
int i, offset;
uint8_t r, g, b;
//uint8_t r, g, b;
if (DEBUG)
fprintf(stderr, "sixel_bitmap()\nbitmap:%.2X point(%d, %d)\n",
@ -32,11 +34,13 @@ static inline int sixel_bitmap(struct terminal *term, struct sixel_canvas_t *sc,
break;
if (bitmap & (0x01 << i)) {
//memcpy(sc->pixmap + offset, &sc->color_table[sc->color_index], BYTES_PER_PIXEL);
memcpy(sc->pixmap + offset, &sc->color_table[sc->color_index], BYTES_PER_PIXEL);
/*
split_rgb(sc->color_table[sc->color_index], &r, &g, &b);
*(sc->pixmap + offset + 0) = b;
*(sc->pixmap + offset + 1) = g;
*(sc->pixmap + offset + 2) = r;
*/
}
offset += sc->line_length;

2
yaft.h
View file

@ -35,7 +35,7 @@ enum char_code {
enum misc {
BUFSIZE = 1024, /* read, esc, various buffer size */
BITS_PER_BYTE = 8,
BYTES_PER_PIXEL = 3, /* pixel size of sixel bitmap data */
BYTES_PER_PIXEL = 4, /* pixel size of sixel pixmap data */
BITS_PER_SIXEL = 6, /* number of bits of a sixel */
ESCSEQ_SIZE = 1024, /* limit size of terminal escape sequence */
SELECT_TIMEOUT = 15000, /* used by select() */