Simplified colormode enum
svn-id: r41578
This commit is contained in:
parent
fb96e826f2
commit
d3283f86fc
1 changed files with 9 additions and 6 deletions
|
@ -45,14 +45,17 @@ namespace Graphics {
|
||||||
*/
|
*/
|
||||||
enum ColorMode {
|
enum ColorMode {
|
||||||
kFormatCLUT8 = 0, //256 color palette.
|
kFormatCLUT8 = 0, //256 color palette.
|
||||||
|
#ifdef ENABLE_16BIT
|
||||||
kFormatRGB555 = 1,
|
kFormatRGB555 = 1,
|
||||||
kFormatXRGB1555 = 2, // Special case, high bit has special purpose, which may be alpha.
|
kFormatXRGB1555 = 2, // Special case, high bit has special purpose, which may be alpha.
|
||||||
// Engines should probably handle this bit internally and pass RGB only, though
|
// Engines should probably handle this bit internally and pass RGB only, though
|
||||||
kFormatRGB565 = 3,
|
kFormatRGB565 = 3,
|
||||||
kFormatRGBA4444 = 4, // since this mode is commonly supported in game hardware, some unimplemented engines may use it?
|
kFormatRGBA4444 = 4, // since this mode is commonly supported in game hardware, some unimplemented engines may use it?
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_32BIT
|
||||||
kFormatRGB888 = 5,
|
kFormatRGB888 = 5,
|
||||||
kFormatRGBA6666 = 6, // I've never heard of this, but it's vaguely plausible
|
kFormatRGBA8888 = 6
|
||||||
kFormatRGBA8888 = 7
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -96,6 +99,7 @@ struct PixelFormat {
|
||||||
//TODO: Specify alpha position
|
//TODO: Specify alpha position
|
||||||
explicit inline PixelFormat(ColorMode mode) {
|
explicit inline PixelFormat(ColorMode mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
#ifdef ENABLE_16BIT
|
||||||
case kFormatRGB555:
|
case kFormatRGB555:
|
||||||
aLoss = 8;
|
aLoss = 8;
|
||||||
bytesPerPixel = 2;
|
bytesPerPixel = 2;
|
||||||
|
@ -124,19 +128,18 @@ struct PixelFormat {
|
||||||
bytesPerPixel = 2;
|
bytesPerPixel = 2;
|
||||||
aLoss = gLoss = rLoss = bLoss = 4;
|
aLoss = gLoss = rLoss = bLoss = 4;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_32BIT
|
||||||
case kFormatRGB888:
|
case kFormatRGB888:
|
||||||
bytesPerPixel = 3;
|
bytesPerPixel = 3;
|
||||||
aLoss = 8;
|
aLoss = 8;
|
||||||
gLoss = rLoss = bLoss = 0;
|
gLoss = rLoss = bLoss = 0;
|
||||||
break;
|
break;
|
||||||
case kFormatRGBA6666:
|
|
||||||
bytesPerPixel = 3;
|
|
||||||
aLoss = gLoss = rLoss = bLoss = 2;
|
|
||||||
break;
|
|
||||||
case kFormatRGBA8888:
|
case kFormatRGBA8888:
|
||||||
bytesPerPixel = 4;
|
bytesPerPixel = 4;
|
||||||
aLoss = gLoss = rLoss = bLoss = 0;
|
aLoss = gLoss = rLoss = bLoss = 0;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case kFormatCLUT8:
|
case kFormatCLUT8:
|
||||||
default:
|
default:
|
||||||
bytesPerPixel = 1;
|
bytesPerPixel = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue