Torque3D Documentation / _generateds / x86UNIXAsmBlit.cpp

x86UNIXAsmBlit.cpp

Engine/source/platformX86UNIX/x86UNIXAsmBlit.cpp

More...

Public Functions

bitmapExtrude5551_asm(const void * srcMip, void * mip, U32 height, U32 width)

Detailed Description

Public Functions

bitmapExtrude5551_asm(const void * srcMip, void * mip, U32 height, U32 width)

PlatformBlitInit()

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#include "math/mMath.h"
25#include "gfx/bitmap/bitmapUtils.h"
26
27//--------------------------------------------------------------------------
28void bitmapExtrude5551_asm(const void *srcMip, void *mip, U32 height, U32 width)
29{
30   const U16 *src = (const U16 *) srcMip;
31   U16 *dst = (U16 *) mip;
32   U32 stride = width << 1;
33
34   for(U32 y = 0; y < height; y++)
35   {
36      for(U32 x = 0; x < width; x++)
37      {
38         U32 a = src[0];
39         U32 b = src[1];
40         U32 c = src[stride];
41         U32 d = src[stride+1];
42         dst[x] = ((((a >> 11) + (b >> 11) + (c >> 11) + (d >> 11)) >> 2) << 11) |
43                  (((  ((a >> 6) & 0x1f) + ((b >> 6) & 0x1f) + ((c >> 6) & 0x1f) + ((d >> 6) & 0x1F) ) >> 2) << 6) |
44                  ((( ((a >> 1) & 0x1F) + ((b >> 1) & 0x1F) + ((c >> 1) & 0x1f) + ((d >> 1) & 0x1f)) >> 2) << 1);
45         src += 2;
46      }
47      src += stride;
48      dst += width;
49   }
50}
51
52//--------------------------------------------------------------------------
53void PlatformBlitInit()
54{
55   bitmapExtrude5551 = bitmapExtrude5551_asm;
56   bitmapExtrudeRGB  = bitmapExtrudeRGB_c;
57
58   if (Platform::SystemInfo.processor.properties & CPU_PROP_MMX)
59   {
60      // JMQ: haven't bothered porting mmx bitmap funcs because they don't
61      // seem to offer a big performance boost right now.
62   }
63}
64
65