os/mm/mmdevicefw/mdf/src/video/hwdevicevideoutils/displaymodeutils.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmdevicefw/mdf/src/video/hwdevicevideoutils/displaymodeutils.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,95 @@
     1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "displaymodeutils.h"
    1.20 +
    1.21 +/*
    1.22 + Converts a TRgbFormat into a TDisplayMode.
    1.23 +	 
    1.24 + @param		The TRgbFormat.
    1.25 + @return	The corresponding TDisplayMode, or ERgb if no match found.
    1.26 +*/
    1.27 +TDisplayMode TMMFDisplayModeUtils::DisplayMode(TRgbFormat aRgbFormat) 
    1.28 +	{
    1.29 +	TDisplayMode theDisplayMode = ERgb;
    1.30 +	
    1.31 +	switch(aRgbFormat) 
    1.32 +		{
    1.33 +		case ERgb16bit444:
    1.34 +			theDisplayMode = EColor4K;
    1.35 +			break;
    1.36 +		case ERgb16bit565:
    1.37 +			theDisplayMode = EColor64K;
    1.38 +			break;
    1.39 +		case ERgb32bit888:
    1.40 +			theDisplayMode = EColor16MU;
    1.41 +			break;
    1.42 +		case EFbsBitmapColor4K:
    1.43 +			theDisplayMode = EColor4K;
    1.44 +			break;
    1.45 +		case EFbsBitmapColor64K:
    1.46 +			theDisplayMode = EColor64K;
    1.47 +			break;
    1.48 +		case EFbsBitmapColor16M:
    1.49 +			theDisplayMode = EColor16M;
    1.50 +			break;
    1.51 +		case EFbsBitmapColor16MU:
    1.52 +			theDisplayMode = EColor16MU;
    1.53 +			break;
    1.54 +		default:
    1.55 +			break;			
    1.56 +		}
    1.57 +	return theDisplayMode;
    1.58 +	}
    1.59 +
    1.60 +/*
    1.61 + Converts a TRgbFormat into a the corresponding number of bits per pixel.
    1.62 +	 
    1.63 + @param		The TRgbFormat.
    1.64 + @return	The corresponding number of bits per pixel,
    1.65 +			or KErrNotSupported if no match found.
    1.66 +*/		
    1.67 +TInt TMMFDisplayModeUtilsBytesPerPixel(TRgbFormat aRgbFormat)
    1.68 +	{
    1.69 +	TInt bpp = KErrNotSupported;
    1.70 +	
    1.71 +	switch(aRgbFormat) 
    1.72 +		{
    1.73 +		case ERgb16bit444:
    1.74 +			bpp = 2;
    1.75 +			break;
    1.76 +		case ERgb16bit565:
    1.77 +			bpp = 2;
    1.78 +			break;
    1.79 +		case ERgb32bit888:
    1.80 +			bpp = 4;
    1.81 +			break;
    1.82 +		case EFbsBitmapColor4K:
    1.83 +			bpp = 2;
    1.84 +			break;
    1.85 +		case EFbsBitmapColor64K:
    1.86 +			bpp = 2;
    1.87 +			break;
    1.88 +		case EFbsBitmapColor16M:
    1.89 +			bpp = 3;
    1.90 +			break;
    1.91 +		case EFbsBitmapColor16MU:
    1.92 +			bpp = 4;
    1.93 +			break;
    1.94 +		default:
    1.95 +			break;
    1.96 +		}
    1.97 +	return bpp;
    1.98 +	}