[Scummvm-cvs-logs] CVS: scummvm/common scaler.cpp,1.15,1.16
Max Horn
fingolfin at users.sourceforge.net
Sun May 25 14:55:04 CEST 2003
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv1691
Modified Files:
scaler.cpp
Log Message:
optimized GetResult, based on code by Bertrand Augereau
Index: scaler.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- scaler.cpp 25 May 2003 21:43:16 -0000 1.15
+++ scaler.cpp 25 May 2003 21:54:01 -0000 1.16
@@ -70,24 +70,23 @@
return 1;
}
-static inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D) {
- int x = 0;
- int y = 0;
- int r = 0;
-
- if (A == C)
- x += 1;
- else if (B == C)
- y += 1;
- if (A == D)
- x += 1;
- else if (B == D)
- y += 1;
- if (x <= 1)
- r += 1;
- if (y <= 1)
- r -= 1;
- return r;
+static inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D) {
+ const bool ac = (A==C);
+ const bool bc = (B==C);
+ const int x1 = ac;
+ const int y1 = (bc && !ac);
+ const bool ad = (A==D);
+ const bool bd = (B==D);
+ const int x2 = ad;
+ const int y2 = (bd && !ad);
+ const int x = x1+x2;
+ const int y = y1+y2;
+ static const int rmap[3][3] = {
+ {0, 0, -1},
+ {0, 0, -1},
+ {1, 1, 0}
+ };
+ return rmap[y][x];
}
static inline uint32 INTERPOLATE(uint32 A, uint32 B) {
More information about the Scummvm-git-logs
mailing list