fix PIXR() macro: if MSB of the color is nonzero, it used to return a >255 value, which, say, in Renderer.cpp would get clamped to 255, no matter what the actual red byte is

This commit is contained in:
mniip
2013-12-14 22:25:11 +04:00
parent 5fc07b4c3c
commit 30c80220b2

View File

@@ -33,7 +33,7 @@
#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) #define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8))
#define PIXR(x) (((x)>>8)&0xFF) #define PIXR(x) (((x)>>8)&0xFF)
#define PIXG(x) (((x)>>16)&0xFF) #define PIXG(x) (((x)>>16)&0xFF)
#define PIXB(x) (((x)>>24)) #define PIXB(x) (((x)>>24)&0xFF)
#elif defined(PIX32OGL) #elif defined(PIX32OGL)
#define PIXELCHANNELS 4 #define PIXELCHANNELS 4
#define PIXPACK(x) (0xFF000000|((x)&0xFFFFFF)) //32bit ARGB in 32bit int: AARRGGBB #define PIXPACK(x) (0xFF000000|((x)&0xFFFFFF)) //32bit ARGB in 32bit int: AARRGGBB
@@ -46,7 +46,7 @@
#else #else
#define PIXPACK(x) (x) //24bit RGB in 32bit int: 00RRGGBB. #define PIXPACK(x) (x) //24bit RGB in 32bit int: 00RRGGBB.
#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) #define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b))
#define PIXR(x) ((x)>>16) #define PIXR(x) (((x)>>16)&0xFF)
#define PIXG(x) (((x)>>8)&0xFF) #define PIXG(x) (((x)>>8)&0xFF)
#define PIXB(x) ((x)&0xFF) #define PIXB(x) ((x)&0xFF)
#endif #endif