annotate src/video/qnxgf/SDL_gf_pixelfmt.c @ 3755:e04d9c69a6fd gsoc2009_unit_tests

Updated README a bit.
author Edgar Simo <bobbens@gmail.com>
date Thu, 06 Aug 2009 17:00:07 +0000
parents 7f684f249ec9
children 44d5474c2c8a
rev   line source
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
21
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
22 QNX Graphics Framework SDL driver
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
23 Copyright (C) 2009 Mike Gorchak
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
24 (mike@malva.ua, lestat@i.com.ua)
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 */
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include "SDL_config.h"
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include "SDL_gf_pixelfmt.h"
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
30 gf_format_t
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
31 qnxgf_sdl_to_gf_pixelformat(uint32_t pixelfmt)
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
33 switch (pixelfmt) {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
34 case SDL_PIXELFORMAT_INDEX8:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
35 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
36 return GF_FORMAT_PAL8;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
37 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
38 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
39 case SDL_PIXELFORMAT_ARGB1555:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
40 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
41 return GF_FORMAT_PACK_ARGB1555;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
42 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
43 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
44 case SDL_PIXELFORMAT_ABGR1555:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
45 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
46 return GF_FORMAT_PACK_ARGB1555;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
47 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
48 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
49 case SDL_PIXELFORMAT_RGB565:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
50 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
51 return GF_FORMAT_PACK_RGB565;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
52 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
53 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
54 case SDL_PIXELFORMAT_RGB888:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
55 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
56 return GF_FORMAT_BGR888;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
57 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
58 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
59 case SDL_PIXELFORMAT_BGRA8888:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
60 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
61 return GF_FORMAT_BGRA8888;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
62 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
63 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
64 case SDL_PIXELFORMAT_ARGB8888:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
65 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
66 return GF_FORMAT_ARGB8888;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
67 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
68 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
69 case SDL_PIXELFORMAT_YV12:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
70 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
71 return GF_FORMAT_PLANAR_YUV_YV12;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
72 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
73 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
74 case SDL_PIXELFORMAT_YUY2:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
75 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
76 return GF_FORMAT_PACK_YUV_YUY2;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
77 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
78 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
79 case SDL_PIXELFORMAT_UYVY:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
80 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
81 return GF_FORMAT_PACK_YUV_UYVY;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
82 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
83 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
84 case SDL_PIXELFORMAT_YVYU:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
85 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
86 return GF_FORMAT_PACK_YUV_YVYU;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
87 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
88 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
89 }
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
91 return GF_FORMAT_INVALID;
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 }
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
94 uint32_t
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
95 qnxgf_gf_to_sdl_pixelformat(gf_format_t pixelfmt)
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 {
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
97 switch (pixelfmt) {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
98 case GF_FORMAT_PAL8:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
99 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
100 return SDL_PIXELFORMAT_INDEX8;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
101 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
102 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
103 case GF_FORMAT_PKLE_ARGB1555:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
104 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
105 return SDL_PIXELFORMAT_ARGB1555;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
106 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
107 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
108 case GF_FORMAT_PACK_ARGB1555:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
109 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
110 return SDL_PIXELFORMAT_ARGB1555;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
111 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
112 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
113 case GF_FORMAT_PKBE_ARGB1555:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
114 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
115 return SDL_PIXELFORMAT_ABGR1555;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
116 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
117 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
118 case GF_FORMAT_PKBE_RGB565:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
119 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
120 return SDL_PIXELFORMAT_RGB565;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
121 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
122 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
123 case GF_FORMAT_PKLE_RGB565:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
124 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
125 return SDL_PIXELFORMAT_RGB565;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
126 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
127 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
128 case GF_FORMAT_PACK_RGB565:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
129 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
130 return SDL_PIXELFORMAT_RGB565;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
131 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
132 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
133 case GF_FORMAT_BGR888:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
134 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
135 return SDL_PIXELFORMAT_RGB888;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
136 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
137 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
138 case GF_FORMAT_BGRA8888:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
139 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
140 return SDL_PIXELFORMAT_BGRA8888;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
141 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
142 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
143 case GF_FORMAT_ARGB8888:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
144 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
145 return SDL_PIXELFORMAT_ARGB8888;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
146 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
147 break;
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
149 case GF_FORMAT_PLANAR_YUV_YV12:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
150 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
151 return SDL_PIXELFORMAT_YV12;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
152 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
153 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
154 case GF_FORMAT_PACK_YUV_YUY2:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
155 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
156 return SDL_PIXELFORMAT_YUY2;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
157 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
158 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
159 case GF_FORMAT_PACK_YUV_UYVY:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
160 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
161 return SDL_PIXELFORMAT_UYVY;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
162 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
163 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
164 case GF_FORMAT_PACK_YUV_YVYU:
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
165 {
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
166 return SDL_PIXELFORMAT_YVYU;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
167 }
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
168 break;
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
169 }
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170
3139
Sam Lantinga <slouken@libsdl.org>
parents: 3092
diff changeset
171 return SDL_PIXELFORMAT_UNKNOWN;
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
173
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
174 /* vi: set ts=4 sw=4 expandtab: */