1 /*
2  * OpenBOR - http://www.chronocrash.com
3  * -----------------------------------------------------------------------
4  * All rights reserved, see LICENSE in OpenBOR root for details.
5  *
6  * Copyright (c) 2004 - 2014 OpenBOR Team
7  */
8 
9 #include "gfxtypes.h"
10 
Tv2x(u8 * srcPtr,u32 srcPitch,u8 * deltaPtr,u8 * dstPtr,u32 dstPitch,int width,int height)11 void Tv2x(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, int width, int height)
12 {
13     u32 nextlineSrc = srcPitch / sizeof(u16);
14     u32 nextlineDst = dstPitch / sizeof(u16);
15     u16 *p = (u16 *)srcPtr;
16     u16 *q = (u16 *)dstPtr;
17 
18     while(height--)
19     {
20         int i = 0, j = 0;
21         for(; i < width; ++i, j += 2)
22         {
23             u16 p1 = *(p + i);
24             u32 pi;
25             pi = (((p1 & GfxRedBlueMask) * 7) >> 3) & GfxRedBlueMask;
26             pi |= (((p1 & GfxGreenMask) * 7) >> 3) & GfxGreenMask;
27             *(q + j) = p1;
28             *(q + j + 1) = p1;
29             *(q + j + nextlineDst) = pi;
30             *(q + j + nextlineDst + 1) = pi;
31         }
32         p += nextlineSrc;
33         q += nextlineDst << 1;
34     }
35 }
36