diff --git a/src/hq4x.c b/src/hq4x.c index 5614ef64d..749ced580 100644 --- a/src/hq4x.c +++ b/src/hq4x.c @@ -178,9 +178,9 @@ void hq4x_32(SDL_Surface * src, SDL_Surface * dest, int prevline, nextline; Uint16 w[10]; Uint8 a; - Uint32 YUV1, YUV2; int pattern; int flag; + Uint32 YUV1, YUV2; /* diff --git a/src/hqxx.c b/src/hqxx.c index 7bc8b1566..596c2254b 100644 --- a/src/hqxx.c +++ b/src/hqxx.c @@ -181,7 +181,9 @@ void InitLUTs(Uint32 * RGBtoYUV) Y = (r + g + b) >> 2; u = 128 + ((r - b) >> 2); v = 128 + ((-r + 2 * g - b) >> 3); - RGBtoYUV[(i << 11) + (j << 5) + k] = (Y << 16) + (u << 8) + v; + RGBtoYUV[(i << 11) + (j << 5) + k] = (((Y & 0xF8) << 8) | + ((u & 0xFE) << 3) | + (v >> 3)); } } } @@ -208,11 +210,15 @@ inline void Interp2(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint { Uint32 c; + /* FIXME? */ + // c = (c1 * 2 + c2 + c3) >> 2; c = ((((c1 & 0x07E0) * 2 + (c2 & 0x07E0) + (c3 & 0x07E0)) & (0x07E0 << 2)) + (((c1 & 0xF81F) * 2 + (c2 & 0xF81F) + (c3 & 0xF81F)) & (0xF81F << 2))) >> 2; + + hqxx_putpixel(dest, x, y, c, alpha); } @@ -246,7 +252,7 @@ inline void Interp4(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint c = ((((c1 & 0x07E0) * 2 + ((c2 & 0x07E0) + - (c3 & 0x07E0)) * 7) & 0x07E00) + + (c3 & 0x07E0)) * 7) & 0x7E00) + (((c1 & 0xF81F) * 2 + ((c2 & 0xF81F) + (c3 & 0xF81F)) * 7) & 0xF81F0)) >> 4; diff --git a/src/hqxx.h b/src/hqxx.h index 856f98bc6..8a38a9ede 100644 --- a/src/hqxx.h +++ b/src/hqxx.h @@ -27,21 +27,17 @@ #include "SDL.h" -#define Ymask 0x00FF0000 -#define Umask 0x0000FF00 -#define Vmask 0x000000FF +#define Ymask 0xF800 +#define Umask 0x07E0 +#define Vmask 0x001F -//#define Ymask 0xF800 -//#define Umask 0x07E0 -//#define Vmask 0x001F +//trY in 32 = 0x00300000 +//trU in 32 = 0x00000700 +//trV in 32 = 0x00000006 -#define trY 0x00300000 -#define trU 0x00000700 -#define trV 0x00000006 - -//#define trY 0x3000 -//#define trU 0x00C0 -//#define trV 0x0006 +#define trY 0x3000 +#define trU 0x00C0 +#define trV 0x0006 Uint16 hqxx_getpixel(SDL_Surface * surface, int x, int y, Uint8 * alpha); diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 34b75e245..04b4b0aa7 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -38,7 +38,7 @@ /* #define USE_HWSURFACE */ -/* #define USE_HQ4X */ +#define USE_HQ4X /* Disable fancy cursors in fullscreen mode, to avoid SDL bug: */ @@ -3007,7 +3007,7 @@ void stamp_draw(int x, int y) /* Shrink or grow it! */ -#ifdef HQ4X +#ifdef USE_HQ4X if (state_stamps[cur_stamp]->size == 400) { /* Use high quality 4x filter! */