sl@0
|
1 |
// Copyright (c) 1997-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 "BMCONV.H"
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
int BitmapUtils::ByteWidth(int aPixelWidth,int aBitsPerPixel)
|
sl@0
|
20 |
{
|
sl@0
|
21 |
int wordWidth = 0;
|
sl@0
|
22 |
|
sl@0
|
23 |
switch (aBitsPerPixel)
|
sl@0
|
24 |
{
|
sl@0
|
25 |
case 1:
|
sl@0
|
26 |
wordWidth = (aPixelWidth + 31) / 32;
|
sl@0
|
27 |
break;
|
sl@0
|
28 |
case 2:
|
sl@0
|
29 |
wordWidth = (aPixelWidth + 15) / 16;
|
sl@0
|
30 |
break;
|
sl@0
|
31 |
case 4:
|
sl@0
|
32 |
wordWidth = (aPixelWidth + 7) / 8;
|
sl@0
|
33 |
break;
|
sl@0
|
34 |
case 8:
|
sl@0
|
35 |
wordWidth = (aPixelWidth + 3) / 4;
|
sl@0
|
36 |
break;
|
sl@0
|
37 |
case 12:
|
sl@0
|
38 |
case 16:
|
sl@0
|
39 |
wordWidth = (aPixelWidth + 1) / 2;
|
sl@0
|
40 |
break;
|
sl@0
|
41 |
case 24:
|
sl@0
|
42 |
wordWidth = (((aPixelWidth * 3) + 11) / 12) * 3;
|
sl@0
|
43 |
break;
|
sl@0
|
44 |
case 32:
|
sl@0
|
45 |
wordWidth = aPixelWidth;
|
sl@0
|
46 |
break;
|
sl@0
|
47 |
default:
|
sl@0
|
48 |
break;
|
sl@0
|
49 |
};
|
sl@0
|
50 |
|
sl@0
|
51 |
return wordWidth * 4;
|
sl@0
|
52 |
}
|
sl@0
|
53 |
|