aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/helpers.h
diff options
context:
space:
mode:
authorColin Snover2017-07-03 20:12:39 -0500
committerColin Snover2017-07-06 19:12:38 -0500
commit7057f232d75732c320fb470a8632a4c2f055a47f (patch)
treefe9bb0cb48530eee2c6a35fd911240e46efcce21 /engines/sci/graphics/helpers.h
parent8cb35442c073b5ed5a0f3fa7d5e627bdd85af229 (diff)
downloadscummvm-rg350-7057f232d75732c320fb470a8632a4c2f055a47f.tar.gz
scummvm-rg350-7057f232d75732c320fb470a8632a4c2f055a47f.tar.bz2
scummvm-rg350-7057f232d75732c320fb470a8632a4c2f055a47f.zip
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.
Diffstat (limited to 'engines/sci/graphics/helpers.h')
-rw-r--r--engines/sci/graphics/helpers.h42
1 files changed, 42 insertions, 0 deletions
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;