Mercurial > sdl-ios-xcode
annotate test/testoverlay2.c @ 1012:f14e3059e138
Date: Mon, 13 Dec 2004 21:28:18 -0500
From: Jonathan Atkins
Subject: [SDL] SDL_SaveBMP width bugfix
this fixes the pitch versus width difference that can happen
(especially for 8bit and 24bit (with the exact RGBAmasks) surfaces)
when you use SDL_SaveBMP. The problem was the pitch was used
instead of the width, which in some cases is much wider than the
screen area you really want to save...making for ugly crud on the
saved image borders.
This code has been tested with & without pitch overhangs...and
with the right masks for 24 bit surfaces.
I tested 8,15,16,24,32-0RGB,32-RGBA(with no SDL_SRCALPHA flag).
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 14 Dec 2004 06:20:49 +0000 |
parents | 05c551e5bc64 |
children | 6b8f0543337c |
rev | line source |
---|---|
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /******************************************************************************** |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 * * |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 * Test of the overlay used for moved pictures, test more closed to real life. * |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 * Running trojan moose :) Coded by Mike Gorchak. * |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 * * |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 ********************************************************************************/ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 #include "SDL.h" |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 #define MOOSEPIC_W 64 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 #define MOOSEPIC_H 88 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 #define MOOSEFRAME_SIZE (MOOSEPIC_W * MOOSEPIC_H) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 #define MOOSEFRAMES_COUNT 10 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 SDL_Color MooseColors[84]={ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 { 49, 49, 49}, { 66, 24, 0}, { 66, 33, 0}, { 66, 66, 66}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 { 66, 115, 49}, { 74, 33, 0}, { 74, 41, 16}, { 82, 33, 8}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 { 82, 41, 8}, { 82, 49, 16}, { 82, 82, 82}, { 90, 41, 8}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 { 90, 41, 16}, { 90, 57, 24}, { 99, 49, 16}, { 99, 66, 24}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 { 99, 66, 33}, { 99, 74, 33}, {107, 57, 24}, {107, 82, 41}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 {115, 57, 33}, {115, 66, 33}, {115, 66, 41}, {115, 74, 0}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 {115, 90, 49}, {115, 115, 115}, {123, 82, 0}, {123, 99, 57}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 {132, 66, 41}, {132, 74, 41}, {132, 90, 8}, {132, 99, 33}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 {132, 99, 66}, {132, 107, 66}, {140, 74, 49}, {140, 99, 16}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 {140, 107, 74}, {140, 115, 74}, {148, 107, 24}, {148, 115, 82}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 {148, 123, 74}, {148, 123, 90}, {156, 115, 33}, {156, 115, 90}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 {156, 123, 82}, {156, 132, 82}, {156, 132, 99}, {156, 156, 156}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 {165, 123, 49}, {165, 123, 90}, {165, 132, 82}, {165, 132, 90}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 {165, 132, 99}, {165, 140, 90}, {173, 132, 57}, {173, 132, 99}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 {173, 140, 107}, {173, 140, 115}, {173, 148, 99}, {173, 173, 173}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 {181, 140, 74}, {181, 148, 115}, {181, 148, 123}, {181, 156, 107}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 {189, 148, 123}, {189, 156, 82}, {189, 156, 123}, {189, 156, 132}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 {189, 189, 189}, {198, 156, 123}, {198, 165, 132}, {206, 165, 99}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 {206, 165, 132}, {206, 173, 140}, {206, 206, 206}, {214, 173, 115}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 {214, 173, 140}, {222, 181, 148}, {222, 189, 132}, {222, 189, 156}, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 {222, 222, 222}, {231, 198, 165}, {231, 231, 231}, {239, 206, 173} |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 }; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 /* All RGB2YUV conversion code and some other parts of code has been taken from testoverlay.c */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 /* NOTE: These RGB conversion functions are not intended for speed, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 only as examples. |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 void RGBtoYUV(Uint8 *rgb, int *yuv, int monochrome, int luminance) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 int i; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 if (monochrome) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 #if 1 /* these are the two formulas that I found on the FourCC site... */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 yuv[1] = 128; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 yuv[2] = 128; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 #else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 yuv[1] = 128; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 yuv[2] = 128; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 #endif |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 #if 1 /* these are the two formulas that I found on the FourCC site... */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 yuv[1] = (rgb[2]-yuv[0])*0.565 + 128; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 yuv[2] = (rgb[0]-yuv[0])*0.713 + 128; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 #else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 #endif |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 if (luminance!=100) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 yuv[0]=yuv[0]*luminance/100; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 if (yuv[0]>255) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 yuv[0]=255; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 ConvertRGBtoYV12(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 int x,y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 int yuv[3]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 Uint8 *p,*op[3]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 SDL_LockSurface(s); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 SDL_LockYUVOverlay(o); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 /* Convert */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 for(y=0; y<s->h && y<o->h; y++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 p=((Uint8 *) s->pixels)+s->pitch*y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 op[0]=o->pixels[0]+o->pitches[0]*y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 op[1]=o->pixels[1]+o->pitches[1]*(y/2); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 op[2]=o->pixels[2]+o->pitches[2]*(y/2); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 for(x=0; x<s->w && x<o->w; x++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 RGBtoYUV(p, yuv, monochrome, luminance); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 *(op[0]++)=yuv[0]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 if(x%2==0 && y%2==0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 *(op[1]++)=yuv[2]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 *(op[2]++)=yuv[1]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 p+=s->format->BytesPerPixel; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 SDL_UnlockYUVOverlay(o); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 SDL_UnlockSurface(s); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 ConvertRGBtoIYUV(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 int x,y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 int yuv[3]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 Uint8 *p,*op[3]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 SDL_LockSurface(s); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 SDL_LockYUVOverlay(o); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 /* Convert */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 for(y=0; y<s->h && y<o->h; y++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 p=((Uint8 *) s->pixels)+s->pitch*y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 op[0]=o->pixels[0]+o->pitches[0]*y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 op[1]=o->pixels[1]+o->pitches[1]*(y/2); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 op[2]=o->pixels[2]+o->pitches[2]*(y/2); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 for(x=0; x<s->w && x<o->w; x++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 RGBtoYUV(p,yuv, monochrome, luminance); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 *(op[0]++)=yuv[0]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 if(x%2==0 && y%2==0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 *(op[1]++)=yuv[1]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 *(op[2]++)=yuv[2]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 p+=s->format->BytesPerPixel; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 SDL_UnlockYUVOverlay(o); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 SDL_UnlockSurface(s); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 ConvertRGBtoUYVY(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 int x,y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 int yuv[3]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 Uint8 *p,*op; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 SDL_LockSurface(s); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 SDL_LockYUVOverlay(o); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 for(y=0; y<s->h && y<o->h; y++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 p=((Uint8 *) s->pixels)+s->pitch*y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 op=o->pixels[0]+o->pitches[0]*y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 for(x=0; x<s->w && x<o->w; x++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 RGBtoYUV(p, yuv, monochrome, luminance); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 if(x%2==0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 *(op++)=yuv[1]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 *(op++)=yuv[0]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 *(op++)=yuv[2]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 *(op++)=yuv[0]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 p+=s->format->BytesPerPixel; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 SDL_UnlockYUVOverlay(o); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 SDL_UnlockSurface(s); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 ConvertRGBtoYVYU(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 int x,y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 int yuv[3]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 Uint8 *p,*op; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 SDL_LockSurface(s); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 SDL_LockYUVOverlay(o); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 for(y=0; y<s->h && y<o->h; y++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 p=((Uint8 *) s->pixels)+s->pitch*y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 op=o->pixels[0]+o->pitches[0]*y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 for(x=0; x<s->w && x<o->w; x++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 RGBtoYUV(p,yuv, monochrome, luminance); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 if(x%2==0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 *(op++)=yuv[0]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 *(op++)=yuv[2]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 op[1]=yuv[1]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 *op=yuv[0]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 op+=2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 p+=s->format->BytesPerPixel; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 SDL_UnlockYUVOverlay(o); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 SDL_UnlockSurface(s); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 ConvertRGBtoYUY2(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 int x,y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 int yuv[3]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 Uint8 *p,*op; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 SDL_LockSurface(s); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 SDL_LockYUVOverlay(o); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 for(y=0; y<s->h && y<o->h; y++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 p=((Uint8 *) s->pixels)+s->pitch*y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 op=o->pixels[0]+o->pitches[0]*y; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 for(x=0; x<s->w && x<o->w; x++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 RGBtoYUV(p,yuv, monochrome, luminance); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 if(x%2==0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 *(op++)=yuv[0]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 *(op++)=yuv[1]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 op[1]=yuv[2]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 *op=yuv[0]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 op+=2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 p+=s->format->BytesPerPixel; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 SDL_UnlockYUVOverlay(o); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 SDL_UnlockSurface(s); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 static void PrintUsage(char *argv0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 fprintf(stderr, "Usage: %s [arg] [arg] [arg] ...\n", argv0); |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
257 fprintf(stderr, "\n"); |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
258 fprintf(stderr, "Where 'arg' is any of the following options:\n"); |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
259 fprintf(stderr, "\n"); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 fprintf(stderr, " -fps <frames per second>\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 fprintf(stderr, " -format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 fprintf(stderr, " -scale <scale factor> (initial scale of the overlay)\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 fprintf(stderr, " -help (shows this help)\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 fprintf(stderr, "\n"); |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
265 fprintf(stderr, "Press ESC to exit, or SPACE to freeze the movie while application running.\n"); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 fprintf(stderr, "\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 int main(int argc, char **argv) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 Uint8* RawMooseData; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 SDL_RWops* handle; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 SDL_Surface* screen; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 SDL_Surface* MooseFrame[MOOSEFRAMES_COUNT]; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 SDL_Overlay* overlay; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 SDL_Rect overlayrect; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 SDL_Event event; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 Uint32 lastftick; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 int paused=0; |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
280 int resized=0; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 int i; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 int fps=12; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 int fpsdelay; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 int overlay_format=SDL_YUY2_OVERLAY; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 int scale=5; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 while ( argc > 1 ) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 if (strcmp(argv[1], "-fps")== 0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 if (argv[2]) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 fps = atoi(argv[2]); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 if (fps==0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 fprintf(stderr, "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 return -1; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 if ((fps<0) || (fps>1000)) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 fprintf(stderr, "The -fps option must be in range from 1 to 1000, default is 12.\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 return -1; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 argv += 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 argc -= 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 fprintf(stderr, "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 return -1; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 } else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 if (strcmp(argv[1], "-format") == 0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 if (argv[2]) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 if (!strcmp(argv[2],"YV12")) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 overlay_format = SDL_YV12_OVERLAY; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 else if(!strcmp(argv[2],"IYUV")) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 overlay_format = SDL_IYUV_OVERLAY; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
321 else if(!strcmp(argv[2],"YUY2")) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 overlay_format = SDL_YUY2_OVERLAY; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 else if(!strcmp(argv[2],"UYVY")) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 overlay_format = SDL_UYVY_OVERLAY; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 else if(!strcmp(argv[2],"YVYU")) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 overlay_format = SDL_YVYU_OVERLAY; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 fprintf(stderr, "The -format option %s is not recognized, see help for info.\n", argv[2]); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 return -1; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
332 argv += 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 argc -= 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
335 else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 fprintf(stderr, "The -format option requires an argument, default is YUY2.\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
338 return -1; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 } else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 if (strcmp(argv[1], "-scale") == 0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 if (argv[2]) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 scale = atoi(argv[2]); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
346 if (scale==0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 fprintf(stderr, "The -scale option requires an argument [from 1 to 50], default is 5.\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 return -1; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 if ((scale<0) || (scale>50)) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 fprintf(stderr, "The -scale option must be in range from 1 to 50, default is 5.\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 return -1; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
355 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 argv += 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 argc -= 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 fprintf(stderr, "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 return -1; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 } else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 if ((strcmp(argv[1], "-help") == 0 ) || (strcmp(argv[1], "-h") == 0)) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 PrintUsage(argv[0]); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 return 0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 } else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 fprintf(stderr, "Unrecognized option: %s.\n", argv[1]); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 return -1; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
373 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 RawMooseData=(Uint8*)malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 if (RawMooseData==NULL) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 fprintf(stderr, "Can't allocate memory for movie !\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 free(RawMooseData); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 return 1; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 /* load the trojan moose images */ |
673
63419da96d13
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
672
diff
changeset
|
386 handle=SDL_RWFromFile("moose.dat", "rb"); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 if (handle==NULL) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 fprintf(stderr, "Can't find the file moose.dat !\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 free(RawMooseData); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 return 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 SDL_RWread(handle, RawMooseData, MOOSEFRAME_SIZE, MOOSEFRAMES_COUNT); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 SDL_RWclose(handle); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
401 free(RawMooseData); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 return 3; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 atexit(SDL_Quit); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 |
673
63419da96d13
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
672
diff
changeset
|
406 /* Set video mode */ |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 if ( (screen=SDL_SetVideoMode(MOOSEPIC_W*scale, MOOSEPIC_H*scale, 0, SDL_RESIZABLE | SDL_SWSURFACE)) == NULL ) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 fprintf(stderr, "Couldn't set video mode: %s\n", 0, SDL_GetError()); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
410 free(RawMooseData); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 return 4; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 /* Set the window manager title bar */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 SDL_WM_SetCaption("SDL test overlay: running moose", "testoverlay2"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 for (i=0; i<MOOSEFRAMES_COUNT; i++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 MooseFrame[i]=SDL_CreateRGBSurfaceFrom(RawMooseData+i*MOOSEFRAME_SIZE, MOOSEPIC_W, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 MOOSEPIC_H, 8, MOOSEPIC_W, 0, 0, 0, 0); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 if (MooseFrame[i]==NULL) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 fprintf(stderr, "Couldn't create SDL_Surfaces:%s\n", 0, SDL_GetError()); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 free(RawMooseData); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 return 5; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 SDL_SetColors(MooseFrame[i], MooseColors, 0, 84); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 SDL_Surface *newsurf; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 SDL_PixelFormat format; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
432 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 format.palette=NULL; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 format.BitsPerPixel=32; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 format.BytesPerPixel=4; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 format.Rshift=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 format.Gshift=8; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 format.Bshift=16; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 #else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 format.Rshift=24; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 format.Gshift=16; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 format.Bshift=8; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 #endif |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 format.Ashift=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 format.Rmask=0xff<<format.Rshift; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 format.Gmask=0xff<<format.Gshift; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
448 format.Bmask=0xff<<format.Bshift; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 format.Amask=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 format.Rloss=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 format.Gloss=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
452 format.Bloss=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 format.Aloss=8; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 format.colorkey=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 format.alpha=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
456 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 newsurf=SDL_ConvertSurface(MooseFrame[i], &format, SDL_SWSURFACE); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 if(!newsurf) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
459 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 fprintf(stderr, "Couldn't convert picture to 32bits RGB: %s\n", SDL_GetError()); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 return 6; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
462 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
463 SDL_FreeSurface(MooseFrame[i]); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
464 MooseFrame[i]=newsurf; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
465 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
466 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
467 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 free(RawMooseData); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
469 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
470 overlay=SDL_CreateYUVOverlay(MOOSEPIC_W, MOOSEPIC_H, overlay_format, screen); |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
471 if (!overlay) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
472 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
473 fprintf(stderr, "Couldn't create overlay: %s\n", SDL_GetError()); |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
474 return 7; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
475 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
476 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 printf("Created %dx%dx%d %s %s overlay\n",overlay->w,overlay->h,overlay->planes, |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
478 overlay->hw_overlay?"hardware":"software", |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
479 overlay->format==SDL_YV12_OVERLAY?"YV12": |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
480 overlay->format==SDL_IYUV_OVERLAY?"IYUV": |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 overlay->format==SDL_YUY2_OVERLAY?"YUY2": |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
482 overlay->format==SDL_UYVY_OVERLAY?"UYVY": |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
483 overlay->format==SDL_YVYU_OVERLAY?"YVYU": |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
484 "Unknown"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
485 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
486 for(i=0; i<overlay->planes; i++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
487 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
488 printf(" plane %d: pitch=%d\n", i, overlay->pitches[i]); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
489 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
490 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
491 overlayrect.x=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 overlayrect.y=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 overlayrect.w=MOOSEPIC_W*scale; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
494 overlayrect.h=MOOSEPIC_H*scale; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
495 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
496 /* set the start frame */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
497 i=0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
498 fpsdelay=1000/fps; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
499 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
500 /* Ignore key up events, they don't even get filtered */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
501 SDL_EventState(SDL_KEYUP, SDL_IGNORE); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
502 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
503 lastftick=SDL_GetTicks(); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
504 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
505 /* Loop, waiting for QUIT or RESIZE */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
506 while (1) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
507 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
508 if (SDL_PollEvent(&event)) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
509 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
510 switch (event.type) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
511 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
512 case SDL_VIDEORESIZE: |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
513 screen=SDL_SetVideoMode(event.resize.w, event.resize.h, 0, SDL_RESIZABLE | SDL_SWSURFACE); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
514 overlayrect.w=event.resize.w; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
515 overlayrect.h=event.resize.h; |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
516 if (paused) |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
517 { |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
518 resized=1; |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
519 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
520 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
521 case SDL_KEYDOWN: |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
522 if (event.key.keysym.sym == SDLK_SPACE) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
523 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
524 paused=!paused; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
525 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
526 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
527 if (event.key.keysym.sym != SDLK_ESCAPE) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
528 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
529 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
530 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
531 case SDL_QUIT: |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
532 SDL_FreeYUVOverlay(overlay); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
533 for (i=0; i<MOOSEFRAMES_COUNT; i++) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
534 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
535 SDL_FreeSurface(MooseFrame[i]); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
536 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
537 return 0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
538 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
539 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
540 |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
541 if ((!paused)||(resized)) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
542 { |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
543 if (((SDL_GetTicks()-lastftick)>fpsdelay)||(resized)) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
544 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
545 lastftick=SDL_GetTicks(); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
546 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
547 switch (overlay_format) |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
548 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
549 case SDL_YUY2_OVERLAY: |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
550 ConvertRGBtoYUY2(MooseFrame[i], overlay, 0, 100); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
551 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
552 case SDL_YV12_OVERLAY: |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
553 ConvertRGBtoYV12(MooseFrame[i], overlay, 0, 100); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
554 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
555 case SDL_UYVY_OVERLAY: |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
556 ConvertRGBtoUYVY(MooseFrame[i], overlay, 0, 100); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
557 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
558 case SDL_YVYU_OVERLAY: |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
559 ConvertRGBtoYVYU(MooseFrame[i], overlay, 0, 100); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
560 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
561 case SDL_IYUV_OVERLAY: |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
562 ConvertRGBtoIYUV(MooseFrame[i], overlay, 0, 100); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
563 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
564 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
565 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
566 SDL_DisplayYUVOverlay(overlay, &overlayrect); |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
567 if (!resized) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
568 { |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
569 i++; |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
570 if (i==10) |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
571 { |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
572 i=0; |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
573 } |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
574 } |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
575 else |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
576 { |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
577 resized=0; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
578 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
579 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
580 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
581 /* kind of timeslice to OS */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
582 SDL_Delay(1); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
583 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
584 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
585 return 0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
586 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
587 |