From 0a0a0c7b0609d8774cef849e7511e7b21d12c5db Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Apr 2004 21:16:32 +0000 Subject: [PATCH] Updated to match scale2x 2.0 svn-id: r13563 --- common/scaler.cpp | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/common/scaler.cpp b/common/scaler.cpp index ed96390962c..bf5da84ca18 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;