aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-01-26 16:45:21 +0000
committerMax Horn2009-01-26 16:45:21 +0000
commit2042c6d5701e5bf9431f5886e5440f68d3e57d38 (patch)
tree874410a3dea34af90e83fc1768beb65bda3de568
parent508f254ff7f962b01055bcd5cde23f43668016f2 (diff)
downloadscummvm-rg350-2042c6d5701e5bf9431f5886e5440f68d3e57d38.tar.gz
scummvm-rg350-2042c6d5701e5bf9431f5886e5440f68d3e57d38.tar.bz2
scummvm-rg350-2042c6d5701e5bf9431f5886e5440f68d3e57d38.zip
Slightly improved interpolate32_1_1
svn-id: r36075
-rw-r--r--graphics/scaler/intern.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/graphics/scaler/intern.h b/graphics/scaler/intern.h
index 2e3760b70a..8f1b546685 100644
--- a/graphics/scaler/intern.h
+++ b/graphics/scaler/intern.h
@@ -40,12 +40,13 @@
/**
* Interpolate two 16 bit pixel *pairs* at once with equal weights 1.
- * In particular, A and B can contain two pixels/each in the upper
- * and lower halves.
+ * In particular, p1 and p2 can contain two pixels each in the upper
+ * and lower halves. Requires only 5 operations!
+ * See <http://www.slack.net/~ant/info/rgb_mixing.html> for details on how this works.
*/
template<int bitFormat>
-static inline uint32 interpolate32_1_1(uint32 A, uint32 B) {
- return (((A & kHighBitsMask) + (B & kHighBitsMask)) >> 1) + (A & B & kLowBitsMask);
+static inline uint32 interpolate32_1_1(uint32 p1, uint32 p2) {
+ return (p1 + p2 - ((p1 ^ p2) & kLowBitsMask)) >> 1;
}
/**