diff --git a/src/blit.c b/src/blit.c index ae8e0c3..a747e16 100644 --- a/src/blit.c +++ b/src/blit.c @@ -101,8 +101,8 @@ void caca_blit(int x1, int y1, int x2, int y2, void *pixels, int w, int h) int tmp = y2; y2 = y1; y1 = tmp; } - pitch = (3 * w + 3) / 4 * 4; - //pitch = 4 * w; + //pitch = (3 * w + 3) / 4 * 4; + pitch = 4 * w; for(y = y1 > 0 ? y1 : 0; y <= y2 && y <= (int)caca_get_height(); y++) { @@ -114,12 +114,12 @@ void caca_blit(int x1, int y1, int x2, int y2, void *pixels, int w, int h) { int fromx = w * (x - x1) / (x2 - x1 + 1); int fromy = h * (y - y1) / (y2 - y1 + 1); - int r = ((unsigned char *)pixels)[3 * fromx + pitch * fromy]; - int g = ((unsigned char *)pixels)[3 * fromx + 1 + pitch * fromy]; - int b = ((unsigned char *)pixels)[3 * fromx + 2 + pitch * fromy]; - //int b = ((unsigned char *)pixels)[4 * fromx + pitch * fromy]; - //int g = ((unsigned char *)pixels)[4 * fromx + 1 + pitch * fromy]; - //int r = ((unsigned char *)pixels)[4 * fromx + 2 + pitch * fromy]; + //int r = ((unsigned char *)pixels)[3 * fromx + pitch * fromy]; + //int g = ((unsigned char *)pixels)[3 * fromx + 1 + pitch * fromy]; + //int b = ((unsigned char *)pixels)[3 * fromx + 2 + pitch * fromy]; + int b = ((unsigned char *)pixels)[4 * fromx + pitch * fromy]; + int g = ((unsigned char *)pixels)[4 * fromx + 1 + pitch * fromy]; + int r = ((unsigned char *)pixels)[4 * fromx + 2 + pitch * fromy]; int hue, sat, val; int min = r, max = r, delta; diff --git a/src/caca.c b/src/caca.c index 83ae86d..53f9874 100644 --- a/src/caca.c +++ b/src/caca.c @@ -97,8 +97,6 @@ int caca_init(void) SLang_init_tty(-1, 0, 1); - SLkp_define_keysym("\e[M", 1001); - if(SLsmg_init_smg() == -1) { SLsig_unblock_signals(); @@ -109,7 +107,8 @@ int caca_init(void) SLsmg_cls(); SLtt_set_cursor_visibility(0); - SLtt_set_mouse_mode (1, 0); + SLkp_define_keysym("\e[M", 1001); + SLtt_set_mouse_mode(1, 0); SLsmg_refresh(); for(i = 0; i < 16; i++) diff --git a/src/io.c b/src/io.c index a45f26b..bb1ae95 100644 --- a/src/io.c +++ b/src/io.c @@ -102,8 +102,8 @@ int caca_get_event(void) key[5] = _read_key(); - event |= (int)(key[3] - ' ') << 8; - event |= (int)(key[4] - ' ') << 4; + event |= (int)(key[3] - ' ') << 16; + event |= (int)(key[4] - ' ') << 8; event |= (int)(key[5] - ' ') << 0; return event;