comparison src/video/photon/SDL_photon_pixelfmt.c @ 3139:7f684f249ec9

indent
author Sam Lantinga <slouken@libsdl.org>
date Sat, 23 May 2009 22:41:08 +0000
parents aa1897bee1e9
children 44d5474c2c8a
comparison
equal deleted inserted replaced
3125:d71d8ceda8b3 3139:7f684f249ec9
24 (mike@malva.ua, lestat@i.com.ua) 24 (mike@malva.ua, lestat@i.com.ua)
25 */ 25 */
26 26
27 #include "SDL_photon_pixelfmt.h" 27 #include "SDL_photon_pixelfmt.h"
28 28
29 uint32_t photon_bits_to_sdl_pixelformat(uint32_t pixelfmt) 29 uint32_t
30 photon_bits_to_sdl_pixelformat(uint32_t pixelfmt)
30 { 31 {
31 switch(pixelfmt) 32 switch (pixelfmt) {
32 { 33 case 8:
33 case 8: 34 {
34 { 35 return SDL_PIXELFORMAT_INDEX8;
35 return SDL_PIXELFORMAT_INDEX8; 36 }
36 } 37 break;
37 break; 38 case 15:
38 case 15: 39 {
39 { 40 return SDL_PIXELFORMAT_ARGB1555;
40 return SDL_PIXELFORMAT_ARGB1555; 41 }
41 } 42 break;
42 break; 43 case 16:
43 case 16: 44 {
44 { 45 return SDL_PIXELFORMAT_RGB565;
45 return SDL_PIXELFORMAT_RGB565; 46 }
46 } 47 break;
47 break; 48 case 24:
48 case 24: 49 {
49 { 50 return SDL_PIXELFORMAT_RGB888;
50 return SDL_PIXELFORMAT_RGB888; 51 }
51 } 52 break;
52 break; 53 case 32:
53 case 32: 54 {
54 { 55 return SDL_PIXELFORMAT_ARGB8888;
55 return SDL_PIXELFORMAT_ARGB8888; 56 }
56 } 57 break;
57 break; 58 }
58 }
59 } 59 }
60 60
61 uint32_t photon_sdl_to_bits_pixelformat(uint32_t pixelfmt) 61 uint32_t
62 photon_sdl_to_bits_pixelformat(uint32_t pixelfmt)
62 { 63 {
63 switch(pixelfmt) 64 switch (pixelfmt) {
64 { 65 case SDL_PIXELFORMAT_INDEX8:
65 case SDL_PIXELFORMAT_INDEX8: 66 {
66 { 67 return 8;
67 return 8; 68 }
68 } 69 break;
69 break; 70 case SDL_PIXELFORMAT_ARGB1555:
70 case SDL_PIXELFORMAT_ARGB1555: 71 {
71 { 72 return 15;
72 return 15; 73 }
73 } 74 break;
74 break; 75 case SDL_PIXELFORMAT_ABGR1555:
75 case SDL_PIXELFORMAT_ABGR1555: 76 {
76 { 77 return 15;
77 return 15; 78 }
78 } 79 break;
79 break; 80 case SDL_PIXELFORMAT_RGB565:
80 case SDL_PIXELFORMAT_RGB565: 81 {
81 { 82 return 16;
82 return 16; 83 }
83 } 84 break;
84 break; 85 case SDL_PIXELFORMAT_RGB888:
85 case SDL_PIXELFORMAT_RGB888: 86 {
86 { 87 return 24;
87 return 24; 88 }
88 } 89 break;
89 break; 90 case SDL_PIXELFORMAT_BGRA8888:
90 case SDL_PIXELFORMAT_BGRA8888: 91 {
91 { 92 return 32;
92 return 32; 93 }
93 } 94 break;
94 break; 95 case SDL_PIXELFORMAT_ARGB8888:
95 case SDL_PIXELFORMAT_ARGB8888: 96 {
96 { 97 return 32;
97 return 32; 98 }
98 } 99 break;
99 break; 100 case SDL_PIXELFORMAT_YV12:
100 case SDL_PIXELFORMAT_YV12: 101 {
101 { 102 return 8;
102 return 8; 103 }
103 } 104 break;
104 break; 105 case SDL_PIXELFORMAT_YUY2:
105 case SDL_PIXELFORMAT_YUY2: 106 {
106 { 107 return 16;
107 return 16; 108 }
108 } 109 break;
109 break; 110 case SDL_PIXELFORMAT_UYVY:
110 case SDL_PIXELFORMAT_UYVY: 111 {
111 { 112 return 16;
112 return 16; 113 }
113 } 114 break;
114 break; 115 case SDL_PIXELFORMAT_YVYU:
115 case SDL_PIXELFORMAT_YVYU: 116 {
116 { 117 return 16;
117 return 16; 118 }
118 } 119 break;
119 break; 120 }
120 }
121 121
122 return 0; 122 return 0;
123 } 123 }
124 124
125 uint32_t photon_image_to_sdl_pixelformat(uint32_t pixelfmt) 125 uint32_t
126 photon_image_to_sdl_pixelformat(uint32_t pixelfmt)
126 { 127 {
127 switch(pixelfmt) 128 switch (pixelfmt) {
128 { 129 case Pg_IMAGE_PALETTE_BYTE:
129 case Pg_IMAGE_PALETTE_BYTE: 130 {
130 { 131 return SDL_PIXELFORMAT_INDEX8;
131 return SDL_PIXELFORMAT_INDEX8; 132 }
132 } 133 break;
133 break; 134 case Pg_IMAGE_DIRECT_8888:
134 case Pg_IMAGE_DIRECT_8888: 135 {
135 { 136 return SDL_PIXELFORMAT_BGRA8888;
136 return SDL_PIXELFORMAT_BGRA8888; 137 }
137 } 138 break;
138 break; 139 case Pg_IMAGE_DIRECT_888:
139 case Pg_IMAGE_DIRECT_888: 140 {
140 { 141 return SDL_PIXELFORMAT_RGB888;
141 return SDL_PIXELFORMAT_RGB888; 142 }
142 } 143 break;
143 break; 144 case Pg_IMAGE_DIRECT_565:
144 case Pg_IMAGE_DIRECT_565: 145 {
145 { 146 return SDL_PIXELFORMAT_RGB565;
146 return SDL_PIXELFORMAT_RGB565; 147 }
147 } 148 break;
148 break; 149 case Pg_IMAGE_DIRECT_555:
149 case Pg_IMAGE_DIRECT_555: 150 {
150 { 151 return SDL_PIXELFORMAT_RGB555;
151 return SDL_PIXELFORMAT_RGB555; 152 }
152 } 153 break;
153 break; 154 case Pg_IMAGE_DIRECT_1555:
154 case Pg_IMAGE_DIRECT_1555: 155 {
155 { 156 return SDL_PIXELFORMAT_ARGB1555;
156 return SDL_PIXELFORMAT_ARGB1555; 157 }
157 } 158 break;
158 break; 159 }
159 }
160 160
161 return 0; 161 return 0;
162 } 162 }
163 163
164 uint32_t photon_sdl_to_image_pixelformat(uint32_t pixelfmt) 164 uint32_t
165 photon_sdl_to_image_pixelformat(uint32_t pixelfmt)
165 { 166 {
166 switch(pixelfmt) 167 switch (pixelfmt) {
167 { 168 case SDL_PIXELFORMAT_INDEX8:
168 case SDL_PIXELFORMAT_INDEX8: 169 {
169 { 170 return Pg_IMAGE_PALETTE_BYTE;
170 return Pg_IMAGE_PALETTE_BYTE; 171 }
171 } 172 break;
172 break; 173 case SDL_PIXELFORMAT_BGRA8888:
173 case SDL_PIXELFORMAT_BGRA8888: 174 {
174 { 175 return Pg_IMAGE_DIRECT_8888;
175 return Pg_IMAGE_DIRECT_8888; 176 }
176 } 177 break;
177 break; 178 case SDL_PIXELFORMAT_RGB888:
178 case SDL_PIXELFORMAT_RGB888: 179 {
179 { 180 return Pg_IMAGE_DIRECT_888;
180 return Pg_IMAGE_DIRECT_888; 181 }
181 } 182 break;
182 break; 183 case SDL_PIXELFORMAT_RGB565:
183 case SDL_PIXELFORMAT_RGB565: 184 {
184 { 185 return Pg_IMAGE_DIRECT_565;
185 return Pg_IMAGE_DIRECT_565; 186 }
186 } 187 break;
187 break; 188 case SDL_PIXELFORMAT_ARGB1555:
188 case SDL_PIXELFORMAT_ARGB1555: 189 {
189 { 190 return Pg_IMAGE_DIRECT_1555;
190 return Pg_IMAGE_DIRECT_1555; 191 }
191 } 192 break;
192 break; 193 }
193 }
194 194
195 return 0; 195 return 0;
196 } 196 }
197 197
198 /* vi: set ts=4 sw=4 expandtab: */ 198 /* vi: set ts=4 sw=4 expandtab: */