Code formatting
svn-id: r41420
This commit is contained in:
parent
8a8366aab5
commit
b4c44a018b
1 changed files with 48 additions and 51 deletions
|
@ -375,13 +375,11 @@ int OSystem_SDL::getGraphicsMode() const {
|
||||||
return _videoMode.mode;
|
return _videoMode.mode;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_16BIT
|
#ifdef ENABLE_16BIT
|
||||||
Graphics::ColorFormat OSystem_SDL::findCompatibleFormat(Common::List<Graphics::ColorFormat> formatList)
|
Graphics::ColorFormat OSystem_SDL::findCompatibleFormat(Common::List<Graphics::ColorFormat> formatList) {
|
||||||
{
|
|
||||||
bool typeAccepted = false;
|
bool typeAccepted = false;
|
||||||
Graphics::ColorFormat format;
|
Graphics::ColorFormat format;
|
||||||
|
|
||||||
while (!formatList.empty() && !typeAccepted)
|
while (!formatList.empty() && !typeAccepted) {
|
||||||
{
|
|
||||||
typeAccepted = false;
|
typeAccepted = false;
|
||||||
format = formatList.front();
|
format = formatList.front();
|
||||||
|
|
||||||
|
@ -391,28 +389,27 @@ Graphics::ColorFormat OSystem_SDL::findCompatibleFormat(Common::List<Graphics::C
|
||||||
return format;
|
return format;
|
||||||
|
|
||||||
formatList.pop_front();
|
formatList.pop_front();
|
||||||
switch (format & Graphics::kFormatTypeMask)
|
switch (format & Graphics::kFormatTypeMask) {
|
||||||
{
|
case Graphics::kFormat8Bit:
|
||||||
case Graphics::kFormat8Bit:
|
if (format == Graphics::kFormat8Bit)
|
||||||
if (format == Graphics::kFormat8Bit)
|
return format;
|
||||||
return format;
|
break;
|
||||||
break;
|
case Graphics::kFormatRGB555:
|
||||||
case Graphics::kFormatRGB555:
|
case Graphics::kFormatARGB1555:
|
||||||
case Graphics::kFormatARGB1555:
|
case Graphics::kFormatRGB565:
|
||||||
case Graphics::kFormatRGB565:
|
typeAccepted = true;
|
||||||
typeAccepted = true;
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!typeAccepted)
|
if (!typeAccepted)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (format & Graphics::kFormatOrderMask) {
|
switch (format & Graphics::kFormatOrderMask) {
|
||||||
case Graphics::kFormatRGB:
|
case Graphics::kFormatRGB:
|
||||||
case Graphics::kFormatRGBA:
|
case Graphics::kFormatRGBA:
|
||||||
return format;
|
return format;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Graphics::kFormat8Bit;
|
return Graphics::kFormat8Bit;
|
||||||
|
@ -434,38 +431,38 @@ void OSystem_SDL::initFormat(Graphics::ColorFormat format) {
|
||||||
Graphics::PixelFormat OSystem_SDL::getPixelFormat(Graphics::ColorFormat format) {
|
Graphics::PixelFormat OSystem_SDL::getPixelFormat(Graphics::ColorFormat format) {
|
||||||
Graphics::PixelFormat result;
|
Graphics::PixelFormat result;
|
||||||
switch (format & Graphics::kFormatTypeMask) {
|
switch (format & Graphics::kFormatTypeMask) {
|
||||||
case Graphics::kFormatARGB1555:
|
case Graphics::kFormatARGB1555:
|
||||||
result.aLoss = 7;
|
result.aLoss = 7;
|
||||||
result.bytesPerPixel = 2;
|
result.bytesPerPixel = 2;
|
||||||
result.rLoss = result.gLoss = result.bLoss = 3;
|
result.rLoss = result.gLoss = result.bLoss = 3;
|
||||||
case Graphics::kFormatRGB555:
|
case Graphics::kFormatRGB555:
|
||||||
result.aLoss = 8;
|
result.aLoss = 8;
|
||||||
result.bytesPerPixel = 2;
|
result.bytesPerPixel = 2;
|
||||||
result.rLoss = result.gLoss = result.bLoss = 3;
|
result.rLoss = result.gLoss = result.bLoss = 3;
|
||||||
break;
|
break;
|
||||||
case Graphics::kFormatRGB565:
|
case Graphics::kFormatRGB565:
|
||||||
result.bytesPerPixel = 2;
|
result.bytesPerPixel = 2;
|
||||||
result.aLoss = 8;
|
result.aLoss = 8;
|
||||||
result.gLoss = 2;
|
result.gLoss = 2;
|
||||||
result.rLoss = result.bLoss = 3;
|
result.rLoss = result.bLoss = 3;
|
||||||
break;
|
break;
|
||||||
case Graphics::kFormat8Bit:
|
case Graphics::kFormat8Bit:
|
||||||
default:
|
default:
|
||||||
result.bytesPerPixel = 1;
|
result.bytesPerPixel = 1;
|
||||||
result.rShift = result.gShift = result.bShift = result.aShift = 0;
|
result.rShift = result.gShift = result.bShift = result.aShift = 0;
|
||||||
result.rLoss = result.gLoss = result.bLoss = result.aLoss = 8;
|
result.rLoss = result.gLoss = result.bLoss = result.aLoss = 8;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
switch (format & Graphics::kFormatOrderMask)
|
switch (format & Graphics::kFormatOrderMask) {
|
||||||
{
|
default:
|
||||||
default:
|
case Graphics::kFormatRGBA:
|
||||||
case Graphics::kFormatRGBA:
|
result.aShift = 0;
|
||||||
result.aShift = 0;
|
// fall through
|
||||||
case Graphics::kFormatRGB:
|
case Graphics::kFormatRGB:
|
||||||
result.bShift = result.aBits();
|
result.bShift = result.aBits();
|
||||||
result.gShift = result.bShift + result.bBits();
|
result.gShift = result.bShift + result.bBits();
|
||||||
result.rShift = result.gShift + result.gBits();
|
result.rShift = result.gShift + result.gBits();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue