|
1 // Copyright (c) 2007-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 /** |
|
17 @file |
|
18 @test |
|
19 */ |
|
20 |
|
21 #include "egltestcommonconversion.h" |
|
22 |
|
23 EXPORT_C TEglTestConfig EglTestConversion::VgFormatToWindowSurfaceFormat(VGImageFormat aVgFormat) |
|
24 { |
|
25 switch(aVgFormat) |
|
26 { |
|
27 case VG_sRGB_565: |
|
28 return EWindowAttribsColor64K; |
|
29 case VG_sARGB_8888: |
|
30 return EWindowAttribsColor16MA; |
|
31 case VG_sARGB_8888_PRE: |
|
32 return EWindowAttribsColor16MAP; |
|
33 default: |
|
34 return EEglTestConfigMax; |
|
35 } |
|
36 } |
|
37 |
|
38 EXPORT_C TEglTestConfig EglTestConversion::VgFormatToPBufferSurfaceFormat(VGImageFormat aVgFormat) |
|
39 { |
|
40 switch(aVgFormat) |
|
41 { |
|
42 case VG_sRGB_565: |
|
43 return EPBufferAttribsColor64K; |
|
44 case VG_sXRGB_8888: |
|
45 return EPBufferAttribsColor16MU; |
|
46 case VG_sARGB_8888: |
|
47 return EPBufferAttribsColor16MA; |
|
48 case VG_sARGB_8888_PRE: |
|
49 return EPBufferAttribsColor16MAP; |
|
50 default: |
|
51 return EEglTestConfigMax; |
|
52 } |
|
53 } |
|
54 |
|
55 EXPORT_C TEglTestConfig EglTestConversion::VgFormatToPixmapSgSurfaceFormat(VGImageFormat aVgFormat) |
|
56 { |
|
57 switch(aVgFormat) |
|
58 { |
|
59 case VG_sRGB_565: |
|
60 return EPixmapAttribsColor64K; |
|
61 case VG_sXRGB_8888: |
|
62 return EPixmapAttribsColor16MU; |
|
63 case VG_sARGB_8888_PRE: |
|
64 return EPixmapAttribsColor16MAP; |
|
65 default: |
|
66 return EEglTestConfigMax; |
|
67 } |
|
68 } |
|
69 |
|
70 EXPORT_C TUidPixelFormat EglTestConversion::VgFormatToSgPixelFormat(VGImageFormat aVgFormat) |
|
71 { |
|
72 switch(aVgFormat) |
|
73 { |
|
74 case VG_sRGB_565: |
|
75 return EUidPixelFormatRGB_565; |
|
76 case VG_sXRGB_8888: |
|
77 return EUidPixelFormatXRGB_8888; |
|
78 case VG_sARGB_8888: |
|
79 return EUidPixelFormatARGB_8888; |
|
80 case VG_sARGB_8888_PRE: |
|
81 return EUidPixelFormatARGB_8888_PRE; |
|
82 case VG_A_8: |
|
83 return EUidPixelFormatA_8; |
|
84 default: |
|
85 return EUidPixelFormatUnknown; |
|
86 } |
|
87 } |
|
88 |
|
89 EXPORT_C VGImageFormat EglTestConversion::PixelFormatToVgFormat(TUidPixelFormat aPixelFormat) |
|
90 { |
|
91 switch(aPixelFormat) |
|
92 { |
|
93 case EUidPixelFormatRGB_565: |
|
94 return VG_sRGB_565; |
|
95 case EUidPixelFormatXRGB_8888: |
|
96 return VG_sXRGB_8888; |
|
97 case EUidPixelFormatARGB_8888: |
|
98 return VG_sARGB_8888; |
|
99 case EUidPixelFormatARGB_8888_PRE: |
|
100 return VG_sARGB_8888_PRE; |
|
101 case EUidPixelFormatA_8: |
|
102 return VG_A_8; |
|
103 default: |
|
104 return VG_IMAGE_FORMAT_INVALID; |
|
105 } |
|
106 } |
|
107 |
|
108 EXPORT_C TDisplayMode EglTestConversion::PixelFormatToDisplayMode(TUidPixelFormat aPixelFormat) |
|
109 { |
|
110 switch(aPixelFormat) |
|
111 { |
|
112 case EUidPixelFormatRGB_565: |
|
113 return EColor64K; |
|
114 case EUidPixelFormatXRGB_8888: |
|
115 return EColor16MU; |
|
116 case EUidPixelFormatARGB_8888: |
|
117 return EColor16MA; |
|
118 case EUidPixelFormatARGB_8888_PRE: |
|
119 return EColor16MAP; |
|
120 case EUidPixelFormatA_8: |
|
121 return EGray256; |
|
122 default: |
|
123 return ENone; |
|
124 } |
|
125 } |
|
126 |
|
127 EXPORT_C TDisplayMode EglTestConversion::VgFormatToDisplayMode(VGImageFormat aVgFormat) |
|
128 { |
|
129 return PixelFormatToDisplayMode( VgFormatToSgPixelFormat(aVgFormat) ); |
|
130 } |
|
131 |
|
132 EXPORT_C TInt EglTestConversion::BytePerPixel(TUidPixelFormat aPixelFormat) |
|
133 { |
|
134 switch(aPixelFormat) |
|
135 { |
|
136 case EUidPixelFormatRGB_565: |
|
137 return 2; |
|
138 case EUidPixelFormatXRGB_8888: |
|
139 case EUidPixelFormatARGB_8888: |
|
140 case EUidPixelFormatARGB_8888_PRE: |
|
141 return 4; |
|
142 case EUidPixelFormatA_8: |
|
143 return 1; |
|
144 default: |
|
145 return 0; |
|
146 } |
|
147 } |