Skip to content

Commit

Permalink
PEGASUS: Make sure we check the pixel format of video frames
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hoops committed Jun 16, 2012
1 parent 625f6cc commit b523875
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions engines/pegasus/movie.cpp
Expand Up @@ -93,13 +93,26 @@ void Movie::redrawMovieWorld() {
if (!frame)
return;

// Make sure we have a surface in the current pixel format
Graphics::Surface *convertedFrame = 0;

if (frame->format != g_system->getScreenFormat()) {
convertedFrame = frame->convertTo(g_system->getScreenFormat());
frame = convertedFrame;
}

// Copy to the surface using _movieBox
uint16 width = MIN<int>(frame->w, _movieBox.width());
uint16 height = MIN<int>(frame->h, _movieBox.height());

for (uint16 y = 0; y < height; y++)
memcpy((byte *)_surface->getBasePtr(_movieBox.left, _movieBox.top + y), (const byte *)frame->getBasePtr(0, y), width * frame->format.bytesPerPixel);

if (convertedFrame) {
convertedFrame->free();
delete convertedFrame;
}

triggerRedraw();
}
}
Expand Down

0 comments on commit b523875

Please sign in to comment.