aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/graphics/helpers.h')
-rw-r--r--engines/sci/graphics/helpers.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/engines/sci/graphics/helpers.h b/engines/sci/graphics/helpers.h
index fbad120374..1d16b49798 100644
--- a/engines/sci/graphics/helpers.h
+++ b/engines/sci/graphics/helpers.h
@@ -139,6 +139,18 @@ inline void mul(Common::Rect &rect, const Common::Rational &ratioX, const Common
}
/**
+ * Multiplies a rectangle by two ratios with default
+ * rounding. Modifies the rect directly. Uses inclusive
+ * rectangle rounding.
+ */
+inline void mulinc(Common::Rect &rect, const Common::Rational &ratioX, const Common::Rational &ratioY) {
+ rect.left = (rect.left * ratioX).toInt();
+ rect.top = (rect.top * ratioY).toInt();
+ rect.right = ((rect.right - 1) * ratioX).toInt() + 1;
+ rect.bottom = ((rect.bottom - 1) * ratioY).toInt() + 1;
+}
+
+/**
* Multiplies a number by a rational number, rounding up to
* the nearest whole number.
*/