diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-12-15 01:04:17 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-12-15 01:04:17 (GMT) |
| commit | b4475ae96f29a0ae64263b010d66c04e9bc5d02d (patch) | |
| tree | 00fb0313d5dde91a0182950c1bad3e03672420b5 /src/graphics/Graphics.h | |
| parent | a1af662b8fad2cc654fdcfda2aeedec24659c908 (diff) | |
| download | powder-b4475ae96f29a0ae64263b010d66c04e9bc5d02d.zip powder-b4475ae96f29a0ae64263b010d66c04e9bc5d02d.tar.gz | |
Very high quality image resampling code curtesy of imageresampler (http://code.google.com/p/imageresampler/), will replace current shitty linear interpolation for SSE2 and renderer builds.
Diffstat (limited to 'src/graphics/Graphics.h')
| -rw-r--r-- | src/graphics/Graphics.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h index 53d3ee7..2c90074 100644 --- a/src/graphics/Graphics.h +++ b/src/graphics/Graphics.h @@ -11,38 +11,40 @@ #include "Config.h" //#include "powder.h" +#define PIXELCHANNELS 3 #ifdef PIX16 #define PIXELSIZE 2 -#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) +#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) //16bit RGB in 16bit int: ???? #define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) #define PIXR(x) (((x)>>8)&0xF8) #define PIXG(x) (((x)>>3)&0xFC) #define PIXB(x) (((x)<<3)&0xF8) #else #define PIXELSIZE 4 -#ifdef PIX32BGR -#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) +#ifdef PIX32BGRA +#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) //24bit BGR in 32bit int: 00BBGGRR #define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) #define PIXR(x) ((x)&0xFF) #define PIXG(x) (((x)>>8)&0xFF) #define PIXB(x) ((x)>>16) #else #ifdef PIX32BGRA -#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) +#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) //32bit BGRA in 32bit int: BBGGRRAA #define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) #define PIXR(x) (((x)>>8)&0xFF) #define PIXG(x) (((x)>>16)&0xFF) #define PIXB(x) (((x)>>24)) #elif defined(PIX32OGL) -#define PIXPACK(x) (0xFF000000|((x)&0xFFFFFF)) -#define PIXRGB(r,g,b) (0xFF000000|((r)<<16)|((g)<<8)|((b)))// (((b)<<16)|((g)<<8)|(r)) -#define PIXRGBA(r,g,b,a) (((a)<<24)|((r)<<16)|((g)<<8)|((b)))// (((b)<<16)|((g)<<8)|(r)) +#define PIXELCHANNELS 4 +#define PIXPACK(x) (0xFF000000|((x)&0xFFFFFF)) //32bit ARGB in 32bit int: AARRGGBB +#define PIXRGB(r,g,b) (0xFF000000|((r)<<16)|((g)<<8)|((b))) +#define PIXRGBA(r,g,b,a) (((a)<<24)|((r)<<16)|((g)<<8)|((b))) #define PIXA(x) (((x)>>24)&0xFF) #define PIXR(x) (((x)>>16)&0xFF) #define PIXG(x) (((x)>>8)&0xFF) #define PIXB(x) ((x)&0xFF) #else -#define PIXPACK(x) (x) +#define PIXPACK(x) (x) //24bit RGB in 32bit int: 00RRGGBB. #define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) #define PIXR(x) ((x)>>16) #define PIXG(x) (((x)>>8)&0xFF) |
