comparison test/testoverlay2.c @ 1439:4d3bb026cd16

Fixed warnings in -pedantic mode
author Sam Lantinga <slouken@libsdl.org>
date Sun, 26 Feb 2006 05:02:14 +0000
parents be9c9c8f6d53
children f1211a4b7380
comparison
equal deleted inserted replaced
1438:1f4f09641645 1439:4d3bb026cd16
55 only as examples. 55 only as examples.
56 */ 56 */
57 57
58 void RGBtoYUV(Uint8 *rgb, int *yuv, int monochrome, int luminance) 58 void RGBtoYUV(Uint8 *rgb, int *yuv, int monochrome, int luminance)
59 { 59 {
60 int i;
61
62 if (monochrome) 60 if (monochrome)
63 { 61 {
64 #if 1 /* these are the two formulas that I found on the FourCC site... */ 62 #if 1 /* these are the two formulas that I found on the FourCC site... */
65 yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2]; 63 yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
66 yuv[1] = 128; 64 yuv[1] = 128;
90 if (yuv[0]>255) 88 if (yuv[0]>255)
91 yuv[0]=255; 89 yuv[0]=255;
92 } 90 }
93 } 91 }
94 92
95 ConvertRGBtoYV12(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance) 93 void ConvertRGBtoYV12(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
96 { 94 {
97 int x,y; 95 int x,y;
98 int yuv[3]; 96 int yuv[3];
99 Uint8 *p,*op[3]; 97 Uint8 *p,*op[3];
100 98
123 121
124 SDL_UnlockYUVOverlay(o); 122 SDL_UnlockYUVOverlay(o);
125 SDL_UnlockSurface(s); 123 SDL_UnlockSurface(s);
126 } 124 }
127 125
128 ConvertRGBtoIYUV(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance) 126 void ConvertRGBtoIYUV(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
129 { 127 {
130 int x,y; 128 int x,y;
131 int yuv[3]; 129 int yuv[3];
132 Uint8 *p,*op[3]; 130 Uint8 *p,*op[3];
133 131
156 154
157 SDL_UnlockYUVOverlay(o); 155 SDL_UnlockYUVOverlay(o);
158 SDL_UnlockSurface(s); 156 SDL_UnlockSurface(s);
159 } 157 }
160 158
161 ConvertRGBtoUYVY(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance) 159 void ConvertRGBtoUYVY(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
162 { 160 {
163 int x,y; 161 int x,y;
164 int yuv[3]; 162 int yuv[3];
165 Uint8 *p,*op; 163 Uint8 *p,*op;
166 164
189 187
190 SDL_UnlockYUVOverlay(o); 188 SDL_UnlockYUVOverlay(o);
191 SDL_UnlockSurface(s); 189 SDL_UnlockSurface(s);
192 } 190 }
193 191
194 ConvertRGBtoYVYU(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance) 192 void ConvertRGBtoYVYU(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
195 { 193 {
196 int x,y; 194 int x,y;
197 int yuv[3]; 195 int yuv[3];
198 Uint8 *p,*op; 196 Uint8 *p,*op;
199 197
225 223
226 SDL_UnlockYUVOverlay(o); 224 SDL_UnlockYUVOverlay(o);
227 SDL_UnlockSurface(s); 225 SDL_UnlockSurface(s);
228 } 226 }
229 227
230 ConvertRGBtoYUY2(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance) 228 void ConvertRGBtoYUY2(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
231 { 229 {
232 int x,y; 230 int x,y;
233 int yuv[3]; 231 int yuv[3];
234 Uint8 *p,*op; 232 Uint8 *p,*op;
235 233
414 SDL_RWclose(handle); 412 SDL_RWclose(handle);
415 413
416 /* Set video mode */ 414 /* Set video mode */
417 if ( (screen=SDL_SetVideoMode(MOOSEPIC_W*scale, MOOSEPIC_H*scale, 0, SDL_RESIZABLE | SDL_SWSURFACE)) == NULL ) 415 if ( (screen=SDL_SetVideoMode(MOOSEPIC_W*scale, MOOSEPIC_H*scale, 0, SDL_RESIZABLE | SDL_SWSURFACE)) == NULL )
418 { 416 {
419 fprintf(stderr, "Couldn't set video mode: %s\n", 0, SDL_GetError()); 417 fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError());
420 free(RawMooseData); 418 free(RawMooseData);
421 quit(4); 419 quit(4);
422 } 420 }
423 421
424 /* Set the window manager title bar */ 422 /* Set the window manager title bar */
428 { 426 {
429 MooseFrame[i]=SDL_CreateRGBSurfaceFrom(RawMooseData+i*MOOSEFRAME_SIZE, MOOSEPIC_W, 427 MooseFrame[i]=SDL_CreateRGBSurfaceFrom(RawMooseData+i*MOOSEFRAME_SIZE, MOOSEPIC_W,
430 MOOSEPIC_H, 8, MOOSEPIC_W, 0, 0, 0, 0); 428 MOOSEPIC_H, 8, MOOSEPIC_W, 0, 0, 0, 0);
431 if (MooseFrame[i]==NULL) 429 if (MooseFrame[i]==NULL)
432 { 430 {
433 fprintf(stderr, "Couldn't create SDL_Surfaces:%s\n", 0, SDL_GetError()); 431 fprintf(stderr, "Couldn't create SDL_Surfaces:%s\n", SDL_GetError());
434 free(RawMooseData); 432 free(RawMooseData);
435 quit(5); 433 quit(5);
436 } 434 }
437 SDL_SetColors(MooseFrame[i], MooseColors, 0, 84); 435 SDL_SetColors(MooseFrame[i], MooseColors, 0, 84);
438 436