Mercurial > sdl-ios-xcode
annotate src/video/qnxgf/SDL_gf_pixelfmt.c @ 3278:b2a3cbb9ec08
This is waaaaay outdated. :)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 19 Sep 2009 07:33:15 +0000 |
parents | 44d5474c2c8a |
children | f7b03b6838cb |
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 | 30 gf_format_t |
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 | 33 switch (pixelfmt) { |
34 case SDL_PIXELFORMAT_INDEX8: | |
35 { | |
36 return GF_FORMAT_PAL8; | |
37 } | |
38 break; | |
39 case SDL_PIXELFORMAT_ARGB1555: | |
40 { | |
41 return GF_FORMAT_PACK_ARGB1555; | |
42 } | |
43 break; | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
44 case SDL_PIXELFORMAT_RGB555: |
3139 | 45 { |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
46 /* RGB555 is the same as ARGB1555, but alpha is ignored */ |
3139 | 47 return GF_FORMAT_PACK_ARGB1555; |
48 } | |
49 break; | |
50 case SDL_PIXELFORMAT_RGB565: | |
51 { | |
52 return GF_FORMAT_PACK_RGB565; | |
53 } | |
54 break; | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
55 case SDL_PIXELFORMAT_BGR565: |
3139 | 56 { |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
57 return GF_FORMAT_PKBE_RGB565; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
58 } |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
59 break; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
60 case SDL_PIXELFORMAT_RGB24: |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
61 { |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
62 /* GF has wrong components order */ |
3139 | 63 return GF_FORMAT_BGR888; |
64 } | |
65 break; | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
66 case SDL_PIXELFORMAT_RGB888: |
3139 | 67 { |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
68 /* The same format as ARGB8888, but with alpha ignored */ |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
69 /* and GF has wrong components order */ |
3139 | 70 return GF_FORMAT_BGRA8888; |
71 } | |
72 break; | |
73 case SDL_PIXELFORMAT_ARGB8888: | |
74 { | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
75 /* GF has wrong components order */ |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
76 return GF_FORMAT_BGRA8888; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
77 } |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
78 break; |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
79 case SDL_PIXELFORMAT_BGRA8888: |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
80 { |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
81 /* GF has wrong components order */ |
3139 | 82 return GF_FORMAT_ARGB8888; |
83 } | |
84 break; | |
85 case SDL_PIXELFORMAT_YV12: | |
86 { | |
87 return GF_FORMAT_PLANAR_YUV_YV12; | |
88 } | |
89 break; | |
90 case SDL_PIXELFORMAT_YUY2: | |
91 { | |
92 return GF_FORMAT_PACK_YUV_YUY2; | |
93 } | |
94 break; | |
95 case SDL_PIXELFORMAT_UYVY: | |
96 { | |
97 return GF_FORMAT_PACK_YUV_UYVY; | |
98 } | |
99 break; | |
100 case SDL_PIXELFORMAT_YVYU: | |
101 { | |
102 return GF_FORMAT_PACK_YUV_YVYU; | |
103 } | |
104 break; | |
105 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 |
3139 | 107 return GF_FORMAT_INVALID; |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 } |
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 |
3139 | 110 uint32_t |
111 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
|
112 { |
3139 | 113 switch (pixelfmt) { |
114 case GF_FORMAT_PAL8: | |
115 { | |
116 return SDL_PIXELFORMAT_INDEX8; | |
117 } | |
118 break; | |
119 case GF_FORMAT_PKLE_ARGB1555: | |
120 { | |
121 return SDL_PIXELFORMAT_ARGB1555; | |
122 } | |
123 break; | |
124 case GF_FORMAT_PACK_ARGB1555: | |
125 { | |
126 return SDL_PIXELFORMAT_ARGB1555; | |
127 } | |
128 break; | |
129 case GF_FORMAT_PKBE_RGB565: | |
130 { | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
131 return SDL_PIXELFORMAT_BGR565; |
3139 | 132 } |
133 break; | |
134 case GF_FORMAT_PKLE_RGB565: | |
135 { | |
136 return SDL_PIXELFORMAT_RGB565; | |
137 } | |
138 break; | |
139 case GF_FORMAT_PACK_RGB565: | |
140 { | |
141 return SDL_PIXELFORMAT_RGB565; | |
142 } | |
143 break; | |
144 case GF_FORMAT_BGR888: | |
145 { | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
146 /* GF has wrong components order */ |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
147 return SDL_PIXELFORMAT_RGB24; |
3139 | 148 } |
149 break; | |
150 case GF_FORMAT_BGRA8888: | |
151 { | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
152 /* GF has wrong components order */ |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
153 return SDL_PIXELFORMAT_ARGB8888; |
3139 | 154 } |
155 break; | |
156 case GF_FORMAT_ARGB8888: | |
157 { | |
3185
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
158 /* GF has wrong components order */ |
44d5474c2c8a
Continue working on QNX GF and Photon support.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
159 return SDL_PIXELFORMAT_BGRA8888; |
3139 | 160 } |
161 break; | |
162 case GF_FORMAT_PLANAR_YUV_YV12: | |
163 { | |
164 return SDL_PIXELFORMAT_YV12; | |
165 } | |
166 break; | |
167 case GF_FORMAT_PACK_YUV_YUY2: | |
168 { | |
169 return SDL_PIXELFORMAT_YUY2; | |
170 } | |
171 break; | |
172 case GF_FORMAT_PACK_YUV_UYVY: | |
173 { | |
174 return SDL_PIXELFORMAT_UYVY; | |
175 } | |
176 break; | |
177 case GF_FORMAT_PACK_YUV_YVYU: | |
178 { | |
179 return SDL_PIXELFORMAT_YVYU; | |
180 } | |
181 break; | |
182 } | |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 |
3139 | 184 return SDL_PIXELFORMAT_UNKNOWN; |
3087
0b6f51c29267
Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
186 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
3087
diff
changeset
|
187 /* vi: set ts=4 sw=4 expandtab: */ |