aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-04-12 21:16:32 +0000
committerMax Horn2004-04-12 21:16:32 +0000
commit0a0a0c7b0609d8774cef849e7511e7b21d12c5db (patch)
treeebb6cd8d392bb5597778597f2d8acf0aaececf1f
parent8d6a1c12459fa12493b866786d449265259ed729 (diff)
downloadscummvm-rg350-0a0a0c7b0609d8774cef849e7511e7b21d12c5db.tar.gz
scummvm-rg350-0a0a0c7b0609d8774cef849e7511e7b21d12c5db.tar.bz2
scummvm-rg350-0a0a0c7b0609d8774cef849e7511e7b21d12c5db.zip
Updated to match scale2x 2.0
svn-id: r13563
-rw-r--r--common/scaler.cpp47
1 files changed, 34 insertions, 13 deletions
diff --git a/common/scaler.cpp b/common/scaler.cpp
index ed96390962..bf5da84ca1 100644
--- a/common/scaler.cpp
+++ b/common/scaler.cpp
@@ -176,10 +176,18 @@ void AdvMame2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPi
A = B; B = C; C = *(p - nextlineSrc);
D = E; E = F; F = *(p);
G = H; H = I; I = *(p + nextlineSrc);
- *(q + 0) = D == B && B != F && D != H ? D : E;
- *(q + 1) = B == F && B != D && F != H ? F : E;
- *(q + nextlineDst + 0) = D == H && D != B && H != F ? D : E;
- *(q + nextlineDst + 1) = H == F && D != H && B != F ? F : E;
+
+ if (B != H && D != F) {
+ *(q + 0) = D == B ? D : E;
+ *(q + 1) = B == F ? F : E;
+ *(q + nextlineDst + 0) = D == H ? D : E;
+ *(q + nextlineDst + 1) = H == F ? F : E;
+ } else {
+ *(q + 0) = E;
+ *(q + 1) = E;
+ *(q + nextlineDst + 0) = E;
+ *(q + nextlineDst + 1) = E;
+ }
q += 2;
}
p += nextlineSrc - width;
@@ -216,16 +224,29 @@ void AdvMame3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPi
A = B; B = C; C = *(p - nextlineSrc);
D = E; E = F; F = *(p);
G = H; H = I; I = *(p + nextlineSrc);
+
+ if (B != H && D != F) {
+ *(q + 0) = D == B ? D : E;
+ *(q + 1) = (D == B && E != C) || (B == F && E != A) ? B : E;
+ *(q + 2) = B == F ? F : E;
+ *(q + nextlineDst + 0) = (D == B && E != G) || (D == B && E != A) ? D : E;
+ *(q + nextlineDst + 1) = E;
+ *(q + nextlineDst + 2) = (B == F && E != I) || (H == F && E != C) ? F : E;
+ *(q + 2 * nextlineDst + 0) = D == H ? D : E;
+ *(q + 2 * nextlineDst + 1) = (D == H && E != I) || (H == F && E != G) ? H : E;
+ *(q + 2 * nextlineDst + 2) = H == F ? F : E;
+ } else {
+ *(q + 0) = E;
+ *(q + 1) = E;
+ *(q + 2) = E;
+ *(q + nextlineDst + 0) = E;
+ *(q + nextlineDst + 1) = E;
+ *(q + nextlineDst + 2) = E;
+ *(q + 2 * nextlineDst + 0) = E;
+ *(q + 2 * nextlineDst + 1) = E;
+ *(q + 2 * nextlineDst + 2) = E;
+ }
- *(q) = D == B && B != F && D != H ? D : E;
- *(q + 1) = E;
- *(q + 2) = B == F && B != D && F != H ? F : E;
- *(q + nextlineDst) = E;
- *(q + nextlineDst + 1) = E;
- *(q + nextlineDst + 2) = E;
- *(q + 2 * nextlineDst) = D == H && D != B && H != F ? D : E;
- *(q + 2 * nextlineDst + 1) = E;
- *(q + 2 * nextlineDst + 2) = H == F && D != H && B != F ? F : E;
q += 3;
}
p += nextlineSrc - width;