From 4e31c9aaf4aa36b6fea039d1779317e6a943e68b Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Tue, 26 Jul 2016 19:56:12 -0500 Subject: SCI32: Don't crash on zero-dimension show rects In the original engine this would have simply resulted in no draw, but ScummVM is more strict about it. It is not 100% clear whether these are normal and should be allowed or not, so for the moment we'll emit a warning whenever a zero-dimension show rect is seen. For now they only seem to be generated by plane transitions, and these zero-dimension screen items cannot simply be omitted because the 2.1early transitions code requires a fixed number of screen items per step. --- engines/sci/graphics/frameout.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'engines/sci/graphics/frameout.cpp') diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 7ea159f45d..1decfa03a9 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -1143,6 +1143,13 @@ void GfxFrameout::showBits() { byte *sourceBuffer = (byte *)_currentBuffer.getPixels() + rounded.top * _currentBuffer.screenWidth + rounded.left; + // TODO: Sometimes transition screen items generate zero-dimension + // show rectangles. Is this a bug? + if (rounded.width() == 0 || rounded.height() == 0) { + warning("Zero-dimension show rectangle ignored"); + continue; + } + g_system->copyRectToScreen(sourceBuffer, _currentBuffer.screenWidth, rounded.left, rounded.top, rounded.width(), rounded.height()); } -- cgit v1.2.3