From 5564f36b0e762164d1e6fda5e804723266f8e9ae Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 8 Aug 2004 15:45:58 +0000 Subject: Slightly optimiized Normal2x svn-id: r14519 --- common/scaler.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/scaler.cpp b/common/scaler.cpp index 8b53560afc..77ebdb951a 100644 --- a/common/scaler.cpp +++ b/common/scaler.cpp @@ -123,15 +123,16 @@ void Normal2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit int width, int height) { uint8 *r; + assert(((int)dstPtr & 3) == 0); while (height--) { r = dstPtr; for (int i = 0; i < width; ++i, r += 4) { - uint16 color = *(((const uint16 *)srcPtr) + i); + uint32 color = *(((const uint16 *)srcPtr) + i); + + color |= color << 16; - *(uint16 *)(r + 0) = color; - *(uint16 *)(r + 2) = color; - *(uint16 *)(r + 0 + dstPitch) = color; - *(uint16 *)(r + 2 + dstPitch) = color; + *(uint32 *)(r) = color; + *(uint32 *)(r + dstPitch) = color; } srcPtr += srcPitch; dstPtr += dstPitch << 1; @@ -147,6 +148,7 @@ void Normal3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit const uint32 dstPitch2 = dstPitch * 2; const uint32 dstPitch3 = dstPitch * 3; + assert(((int)dstPtr & 3) == 0); while (height--) { r = dstPtr; for (int i = 0; i < width; ++i, r += 6) { -- cgit v1.2.3