From ddfa227b939d922f738f932997b70110453068cf Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Mon, 13 Aug 2012 02:24:15 +0200 Subject: WINTERMUTE: Cleanup in TransparentSurface. --- engines/wintermute/graphics/transparent_surface.cpp | 21 ++++----------------- engines/wintermute/graphics/transparent_surface.h | 1 - 2 files changed, 4 insertions(+), 18 deletions(-) (limited to 'engines') diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 6bc324dd2b..982399976b 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -62,10 +62,8 @@ void doBlitOpaque(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pit for (uint32 i = 0; i < height; i++) { out = outo; in = ino; + memcpy(out, in, width * 4); for (uint32 j = 0; j < width; j++) { - uint32 pix = *(uint32 *)in; - in += inStep; - *(uint32*)out = pix; out[aIndex] = 0xFF; out += 4; } @@ -133,7 +131,7 @@ void TransparentSurface::doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 outg = g; outr = r; outa = a; - //*(uint32 *)out = target.format.ARGBToColor(o_a, o_r, o_g, o_b); + out[aIndex] = outa; out[bIndex] = outb; out[gIndex] = outg; @@ -143,23 +141,14 @@ void TransparentSurface::doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 default: // alpha blending outa = 255; -//#define USE_LOOKUP_TABLE_FOR_ALPHA -#ifndef USE_LOOKUP_TABLE_FOR_ALPHA - outb = (oPix >> bShiftTarget) & 0xff; - outg = (oPix >> gShiftTarget) & 0xff; - outr = (oPix >> rShiftTarget) & 0xff; - outb += ((b - outb) * a) >> 8; - outg += ((g - outg) * a) >> 8; - outr += ((r - outr) * a) >> 8; -#else + outb = _lookup[(((oPix >> bShiftTarget) & 0xff)) + ((255 - a) << 8)]; outg = _lookup[(((oPix >> gShiftTarget) & 0xff)) + ((255 - a) << 8)]; outr = _lookup[(((oPix >> rShiftTarget) & 0xff)) + ((255 - a) << 8)]; outb += _lookup[b + (a << 8)]; outg += _lookup[g + (a << 8)]; outr += _lookup[r + (a << 8)]; -#endif - //*(uint32 *)out = target.format.ARGBToColor(o_a, o_r, o_g, o_b); + out[aIndex] = outa; out[bIndex] = outb; out[gIndex] = outg; @@ -339,7 +328,6 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p else outr = r; outa = a; - //*(uint32 *)out = target.format.ARGBToColor(o_a, o_r, o_g, o_b); out[aIndex] = outa; out[bIndex] = outb; out[gIndex] = outg; @@ -370,7 +358,6 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p outr += ((r - outr) * a * cr) >> 16; else outr += ((r - outr) * a) >> 8; - //*(uint32 *)out = target.format.ARGBToColor(o_a, o_r, o_g, o_b); out[aIndex] = outa; out[bIndex] = outb; out[gIndex] = outg; diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index 761b7ba196..d9fe00a6d9 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -110,7 +110,6 @@ struct TransparentSurface : public Graphics::Surface { private: static void doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep); static void generateLookup(); - static int *scaleLine(int size, int srcSize); }; /** -- cgit v1.2.3