Skip to content

Commit

Permalink
IMAGE: INDEO: Use the system pixel format for non-8bpp screen modes
Browse files Browse the repository at this point in the history
  • Loading branch information
ccawley2011 authored and rsn8887 committed Apr 14, 2018
1 parent be630b2 commit 9ea1735
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 32 deletions.
36 changes: 20 additions & 16 deletions image/codecs/indeo/indeo.cpp
Expand Up @@ -465,22 +465,26 @@ IVI45DecContext::IVI45DecContext() : _gb(nullptr), _frameNum(0), _frameType(0),
/*------------------------------------------------------------------------*/

IndeoDecoderBase::IndeoDecoderBase(uint16 width, uint16 height, uint bitsPerPixel) : Codec() {
switch (bitsPerPixel) {
case 15:
_pixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0);
break;
case 16:
_pixelFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
break;
case 24:
_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
break;
case 32:
_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
break;
default:
error("Invalid color depth");
break;
_pixelFormat = g_system->getScreenFormat();

if (_pixelFormat.bytesPerPixel == 1) {
switch (bitsPerPixel) {
case 15:
_pixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0);
break;
case 16:
_pixelFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
break;
case 24:
_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
break;
case 32:
_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
break;
default:
error("Invalid color depth");
break;
}
}

_surface.create(width, height, _pixelFormat);
Expand Down
36 changes: 20 additions & 16 deletions image/codecs/indeo3.cpp
Expand Up @@ -44,22 +44,26 @@ Indeo3Decoder::Indeo3Decoder(uint16 width, uint16 height, uint bitsPerPixel) : _
_iv_frame[0].the_buf = 0;
_iv_frame[1].the_buf = 0;

switch (bitsPerPixel) {
case 15:
_pixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0);
break;
case 16:
_pixelFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
break;
case 24:
_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
break;
case 32:
_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
break;
default:
error("Invalid color depth");
break;
_pixelFormat = g_system->getScreenFormat();

if (_pixelFormat.bytesPerPixel == 1) {
switch (bitsPerPixel) {
case 15:
_pixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0);
break;
case 16:
_pixelFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
break;
case 24:
_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
break;
case 32:
_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
break;
default:
error("Invalid color depth");
break;
}
}

_surface = new Graphics::Surface;
Expand Down

0 comments on commit 9ea1735

Please sign in to comment.