uifw/AvKon/AknExtendedFader/inc/AknExtendedFaderGfx_ARM11.inl
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #ifndef AKNEXTENDEDFADERGFX_ARM11_INL_
       
    18 #define AKNEXTENDEDFADERGFX_ARM11_INL_
       
    19 
       
    20 #ifdef __ARM11_SUPPORT
       
    21 
       
    22 // Externalization of our assembler version of the fader
       
    23 extern "C" void FadeAlignedRect_GrayColorize_16MX(TUint32* address, TUint32 height, TUint32 rbCoef, TUint32 gCoef, TUint32 fadeMapFactor, TUint32 fadeMapOffset, TUint32 rbOverlay, TUint32 gOverlay, TUint32 leftwidth, TUint32 middlewidth, TUint32 rightwidth, TUint32 padding);
       
    24 
       
    25 __forceinline void TAknExtendedFaderGfx::PreLoad(TUint32 aStartAddress)
       
    26 	{
       
    27 	asm( "pld [aStartAddress]" );
       
    28     }
       
    29 
       
    30 inline TUint32 TAknExtendedFaderGfx::PixelToGrayscaleWithFade_64K(register TUint32 aPixel, register TInt aFadeMapFactor, register TInt aFadeMapOffset, const TUint32 aROverlay, const TUint32 aGOverlay, const TUint32 aBOverlay)
       
    31 	{
       
    32 	const TUint32 KRCoef(0x00000144); // R coefficient: 324
       
    33 	const TUint32 KGCoef(0x00000009); // G coefficient: 9 (* 64 = 576 as G will already be shifted left 6 bits)
       
    34 	const TUint32 KBCoef(0x0000007C); // B coefficient: 124
       
    35 	
       
    36 	// Unpack R,G,B
       
    37 	register TUint32 r = (aPixel & 0xf800)>>11; // asm("and r, pixel, #0xf800");
       
    38 	register TUint32 g = (aPixel & 0x07e0); // asm("and g, pixel, #0x07e0");
       
    39 	register TUint32 b = aPixel & 0x001f; // asm("and b, pixel, #0x001f");
       
    40 	
       
    41 	// Calculate unadjusted greyscale value
       
    42 	aPixel = r*KRCoef + g*KGCoef + b*KBCoef;
       
    43 		
       
    44 	// Do fading and adjustment to get a greyscale value between 0-255
       
    45 	aPixel = (((aPixel * aFadeMapFactor) >> 15 ) + aFadeMapOffset) & 0xFF;
       
    46 	
       
    47 	// Colorize and pack
       
    48 	aPixel = ((aPixel*aROverlay)&0xf800) | (((aPixel*aGOverlay)>>5)&0x07e0) | ((aPixel*aBOverlay)>>11);
       
    49 	
       
    50 	return aPixel;
       
    51 	}
       
    52 
       
    53 #endif
       
    54 
       
    55 #endif