gfxconversion/bmconv_s60/src/UTILS.CPP
changeset 0 f453ebb75370
equal deleted inserted replaced
-1:000000000000 0:f453ebb75370
       
     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 
       
    18 #include "BMCONV.H"
       
    19 
       
    20 
       
    21 int BitmapUtils::ByteWidth(int aPixelWidth,int aBitsPerPixel)
       
    22 	{
       
    23 	int wordWidth = 0;
       
    24 
       
    25 	switch (aBitsPerPixel)
       
    26 		{
       
    27 	case 1:
       
    28 		wordWidth = (aPixelWidth + 31) / 32;
       
    29 		break;
       
    30 	case 2:
       
    31 		wordWidth = (aPixelWidth + 15) / 16;
       
    32 		break;
       
    33 	case 4:
       
    34 		wordWidth = (aPixelWidth + 7) / 8;
       
    35 		break;
       
    36 	case 8:
       
    37 		wordWidth = (aPixelWidth + 3) / 4;
       
    38 		break;
       
    39 	case 12:
       
    40 	case 16:
       
    41 		wordWidth = (aPixelWidth + 1) / 2;
       
    42 		break;
       
    43 	case 24:
       
    44 		wordWidth = (((aPixelWidth * 3) + 11) / 12) * 3;
       
    45 		break;
       
    46 	case 32:
       
    47 		wordWidth = aPixelWidth;
       
    48 		break;
       
    49 	default:
       
    50 		break;
       
    51 		};
       
    52 
       
    53 	return wordWidth * 4;
       
    54 	}
       
    55