mmplugins/imagingplugins/codecs/JPEGCodec/rgbbufferptr.inl
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #if defined(__ARMCC__)
       
    22 #define FORCEDINLINE __forceinline
       
    23 #else
       
    24 #define FORCEDINLINE inline
       
    25 #endif
       
    26 
       
    27 /*static*/
       
    28 FORCEDINLINE CRgbBufferPtr::TRgbBufferPtr CRgbBufferPtr::Coord2Ptr(CRgbBufferPtr::TRgbBufferPtr aBase, TInt aX, TInt aY)
       
    29 	{
       
    30 	return aBase + aX * aY * KRgbBufferPixelSize;
       
    31 	}
       
    32 	
       
    33 /*static*/
       
    34 FORCEDINLINE TInt CRgbBufferPtr::Coord2Size(TInt aX, TInt aY)
       
    35 	{
       
    36 	return aX * aY * KRgbBufferPixelSize;
       
    37 	}
       
    38 	
       
    39 /*static*/
       
    40 FORCEDINLINE CRgbBufferPtr::TRgbBufferPtr CRgbBufferPtr::ShiftPtr(CRgbBufferPtr::TRgbBufferPtr aPtr, TInt aOffset)
       
    41 	{
       
    42 	return aPtr + aOffset * KRgbBufferPixelSize;
       
    43 	}
       
    44 
       
    45 /*static*/
       
    46 FORCEDINLINE CRgbBufferPtr::TConstRgbBufferPtr CRgbBufferPtr::ShiftPtr(CRgbBufferPtr::TConstRgbBufferPtr aPtr, TInt aOffset)
       
    47 	{
       
    48 	return aPtr + aOffset * KRgbBufferPixelSize;
       
    49 	}
       
    50 /**
       
    51     This function relies on order of colour components within the EColor16M bitmaps
       
    52 */	
       
    53 /*static*/
       
    54 FORCEDINLINE TUint8 CRgbBufferPtr::Red(CRgbBufferPtr::TConstRgbBufferPtr aPtr)
       
    55 	{
       
    56 	return aPtr[ KRedCompIdx ];
       
    57 	}
       
    58 	
       
    59 /**
       
    60     This function relies on order of colour components within the EColor16M bitmaps
       
    61 */
       
    62 /*static*/
       
    63 FORCEDINLINE TUint8 CRgbBufferPtr::Green(CRgbBufferPtr::TConstRgbBufferPtr aPtr)
       
    64 	{
       
    65 	return aPtr[ KGreenCompIdx ];
       
    66 	}
       
    67 	
       
    68 /**
       
    69     This function relies on order of colour components within the EColor16M bitmaps
       
    70 */
       
    71 /*static*/
       
    72 FORCEDINLINE TUint8 CRgbBufferPtr::Blue(CRgbBufferPtr::TConstRgbBufferPtr aPtr)
       
    73 	{
       
    74 	return aPtr[ KBlueCompIdx ];
       
    75 	}
       
    76 
       
    77 FORCEDINLINE TInt CRgbBufferPtr::NextLineOffset() const
       
    78     {
       
    79     return iNextLineOffset;
       
    80     }
       
    81 
       
    82 inline TInt CRgbBufferPtr::PtrShiftValueMCU16(TUint aNumberOfPixels) const
       
    83     {
       
    84     return ( aNumberOfPixels >> 4 ) * (iNextLineOffset / KRgbBufferPixelSize) + (aNumberOfPixels & 0xF);
       
    85     }
       
    86     
       
    87 inline TInt CRgbBufferPtr::PtrShiftValueMCU8(TUint aNumberOfPixels) const
       
    88     {
       
    89     return ( aNumberOfPixels >> 3 ) * (iNextLineOffset / KRgbBufferPixelSize) + (aNumberOfPixels & 0x7);
       
    90     }    
       
    91 
       
    92 
       
    93 
       
    94