os/mm/mmdevicefw/mdf/src/video/hwdevicevideoutils/displaymodeutils.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 #include "displaymodeutils.h"
    17 
    18 /*
    19  Converts a TRgbFormat into a TDisplayMode.
    20 	 
    21  @param		The TRgbFormat.
    22  @return	The corresponding TDisplayMode, or ERgb if no match found.
    23 */
    24 TDisplayMode TMMFDisplayModeUtils::DisplayMode(TRgbFormat aRgbFormat) 
    25 	{
    26 	TDisplayMode theDisplayMode = ERgb;
    27 	
    28 	switch(aRgbFormat) 
    29 		{
    30 		case ERgb16bit444:
    31 			theDisplayMode = EColor4K;
    32 			break;
    33 		case ERgb16bit565:
    34 			theDisplayMode = EColor64K;
    35 			break;
    36 		case ERgb32bit888:
    37 			theDisplayMode = EColor16MU;
    38 			break;
    39 		case EFbsBitmapColor4K:
    40 			theDisplayMode = EColor4K;
    41 			break;
    42 		case EFbsBitmapColor64K:
    43 			theDisplayMode = EColor64K;
    44 			break;
    45 		case EFbsBitmapColor16M:
    46 			theDisplayMode = EColor16M;
    47 			break;
    48 		case EFbsBitmapColor16MU:
    49 			theDisplayMode = EColor16MU;
    50 			break;
    51 		default:
    52 			break;			
    53 		}
    54 	return theDisplayMode;
    55 	}
    56 
    57 /*
    58  Converts a TRgbFormat into a the corresponding number of bits per pixel.
    59 	 
    60  @param		The TRgbFormat.
    61  @return	The corresponding number of bits per pixel,
    62 			or KErrNotSupported if no match found.
    63 */		
    64 TInt TMMFDisplayModeUtilsBytesPerPixel(TRgbFormat aRgbFormat)
    65 	{
    66 	TInt bpp = KErrNotSupported;
    67 	
    68 	switch(aRgbFormat) 
    69 		{
    70 		case ERgb16bit444:
    71 			bpp = 2;
    72 			break;
    73 		case ERgb16bit565:
    74 			bpp = 2;
    75 			break;
    76 		case ERgb32bit888:
    77 			bpp = 4;
    78 			break;
    79 		case EFbsBitmapColor4K:
    80 			bpp = 2;
    81 			break;
    82 		case EFbsBitmapColor64K:
    83 			bpp = 2;
    84 			break;
    85 		case EFbsBitmapColor16M:
    86 			bpp = 3;
    87 			break;
    88 		case EFbsBitmapColor16MU:
    89 			bpp = 4;
    90 			break;
    91 		default:
    92 			break;
    93 		}
    94 	return bpp;
    95 	}