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.
sl@0
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include "displaymodeutils.h"
sl@0
    17
sl@0
    18
/*
sl@0
    19
 Converts a TRgbFormat into a TDisplayMode.
sl@0
    20
	 
sl@0
    21
 @param		The TRgbFormat.
sl@0
    22
 @return	The corresponding TDisplayMode, or ERgb if no match found.
sl@0
    23
*/
sl@0
    24
TDisplayMode TMMFDisplayModeUtils::DisplayMode(TRgbFormat aRgbFormat) 
sl@0
    25
	{
sl@0
    26
	TDisplayMode theDisplayMode = ERgb;
sl@0
    27
	
sl@0
    28
	switch(aRgbFormat) 
sl@0
    29
		{
sl@0
    30
		case ERgb16bit444:
sl@0
    31
			theDisplayMode = EColor4K;
sl@0
    32
			break;
sl@0
    33
		case ERgb16bit565:
sl@0
    34
			theDisplayMode = EColor64K;
sl@0
    35
			break;
sl@0
    36
		case ERgb32bit888:
sl@0
    37
			theDisplayMode = EColor16MU;
sl@0
    38
			break;
sl@0
    39
		case EFbsBitmapColor4K:
sl@0
    40
			theDisplayMode = EColor4K;
sl@0
    41
			break;
sl@0
    42
		case EFbsBitmapColor64K:
sl@0
    43
			theDisplayMode = EColor64K;
sl@0
    44
			break;
sl@0
    45
		case EFbsBitmapColor16M:
sl@0
    46
			theDisplayMode = EColor16M;
sl@0
    47
			break;
sl@0
    48
		case EFbsBitmapColor16MU:
sl@0
    49
			theDisplayMode = EColor16MU;
sl@0
    50
			break;
sl@0
    51
		default:
sl@0
    52
			break;			
sl@0
    53
		}
sl@0
    54
	return theDisplayMode;
sl@0
    55
	}
sl@0
    56
sl@0
    57
/*
sl@0
    58
 Converts a TRgbFormat into a the corresponding number of bits per pixel.
sl@0
    59
	 
sl@0
    60
 @param		The TRgbFormat.
sl@0
    61
 @return	The corresponding number of bits per pixel,
sl@0
    62
			or KErrNotSupported if no match found.
sl@0
    63
*/		
sl@0
    64
TInt TMMFDisplayModeUtilsBytesPerPixel(TRgbFormat aRgbFormat)
sl@0
    65
	{
sl@0
    66
	TInt bpp = KErrNotSupported;
sl@0
    67
	
sl@0
    68
	switch(aRgbFormat) 
sl@0
    69
		{
sl@0
    70
		case ERgb16bit444:
sl@0
    71
			bpp = 2;
sl@0
    72
			break;
sl@0
    73
		case ERgb16bit565:
sl@0
    74
			bpp = 2;
sl@0
    75
			break;
sl@0
    76
		case ERgb32bit888:
sl@0
    77
			bpp = 4;
sl@0
    78
			break;
sl@0
    79
		case EFbsBitmapColor4K:
sl@0
    80
			bpp = 2;
sl@0
    81
			break;
sl@0
    82
		case EFbsBitmapColor64K:
sl@0
    83
			bpp = 2;
sl@0
    84
			break;
sl@0
    85
		case EFbsBitmapColor16M:
sl@0
    86
			bpp = 3;
sl@0
    87
			break;
sl@0
    88
		case EFbsBitmapColor16MU:
sl@0
    89
			bpp = 4;
sl@0
    90
			break;
sl@0
    91
		default:
sl@0
    92
			break;
sl@0
    93
		}
sl@0
    94
	return bpp;
sl@0
    95
	}