From 7057f232d75732c320fb470a8632a4c2f055a47f Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Mon, 3 Jul 2017 20:12:39 -0500 Subject: SCI32: Improve kPlayVMD rendering 1. Added a new game option for linear interpolation when scaling overlay-mode video in ScummVM builds with USE_RGB_COLOR; 2. Implemented SCI2.1-variant of the VMD player renderer (fixes Trac#9857), which bypasses the engine's normal rendering pipeline; 3. Improved accuracy of the SCI3-variant of the VMD player by writing HunkPalettes into the VMD's CelObjMem instead of submitting palettes directly to GfxPalette32. --- engines/sci/graphics/helpers.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'engines/sci/graphics/helpers.h') diff --git a/engines/sci/graphics/helpers.h b/engines/sci/graphics/helpers.h index 1da3749c90..52699c6242 100644 --- a/engines/sci/graphics/helpers.h +++ b/engines/sci/graphics/helpers.h @@ -187,6 +187,48 @@ inline void mulru(Common::Rect &rect, const Common::Rational &ratioX, const Comm rect.bottom = mulru(rect.bottom - 1, ratioY, extra) + 1; } +/** + * Determines the parts of `r` that aren't overlapped by `other`. + * Returns -1 if `r` and `other` have no intersection. + * Returns number of returned parts (in `outRects`) otherwise. + * (In particular, this returns 0 if `r` is contained in `other`.) + */ +inline int splitRects(Common::Rect r, const Common::Rect &other, Common::Rect(&outRects)[4]) { + if (!r.intersects(other)) { + return -1; + } + + int splitCount = 0; + if (r.top < other.top) { + Common::Rect &t = outRects[splitCount++]; + t = r; + t.bottom = other.top; + r.top = other.top; + } + + if (r.bottom > other.bottom) { + Common::Rect &t = outRects[splitCount++]; + t = r; + t.top = other.bottom; + r.bottom = other.bottom; + } + + if (r.left < other.left) { + Common::Rect &t = outRects[splitCount++]; + t = r; + t.right = other.left; + r.left = other.left; + } + + if (r.right > other.right) { + Common::Rect &t = outRects[splitCount++]; + t = r; + t.left = other.right; + } + + return splitCount; +} + struct Buffer : public Graphics::Surface { uint16 screenWidth; uint16 screenHeight; -- cgit v1.2.3