aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorperes2011-05-07 08:38:32 +0900
committerperes2011-05-07 08:38:32 +0900
commit2dddcbf41dc1c37b937150b75b3a3648846e4bfe (patch)
treebfc8172a3e07818df179fdda9cbaa8192517a358
parent99da647e8f496a6d225c0f30073266625cc24f63 (diff)
downloadscummvm-rg350-2dddcbf41dc1c37b937150b75b3a3648846e4bfe.tar.gz
scummvm-rg350-2dddcbf41dc1c37b937150b75b3a3648846e4bfe.tar.bz2
scummvm-rg350-2dddcbf41dc1c37b937150b75b3a3648846e4bfe.zip
GRAPHICS: implement the long awaited interpolate16_5_3
-rw-r--r--graphics/scaler/intern.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/graphics/scaler/intern.h b/graphics/scaler/intern.h
index 4addd6d3bd..7317745e62 100644
--- a/graphics/scaler/intern.h
+++ b/graphics/scaler/intern.h
@@ -77,6 +77,16 @@ static inline unsigned interpolate16_3_1(unsigned p1, unsigned p2) {
}
/**
+ * Interpolate two 16 bit pixels with weights 5 and 3 and 1, i.e., (5*p1+3*p2)/8.
+ */
+template<typename ColorMask>
+static inline unsigned interpolate16_5_3(unsigned p1, unsigned p2) {
+ const unsigned lowbits = (((p1 & ColorMask::kLowBits) << 2) + (p1 & ColorMask::kLow3Bits)
+ + ((p2 & ColorMask::kLow2Bits) << 1) + (p2 & ColorMask::kLow3Bits)) & ColorMask::kLow3Bits;
+ return ((p1*5 + p2*3) - lowbits) >> 3;
+}
+
+/**
* Interpolate two 16 bit pixels with weights 7 and 1, i.e., (7*p1+p2)/8.
*/
template<typename ColorMask>