Finished updating testoverlay2 for the new API and added it to the Visual Studio 2010 projects
This commit is contained in:
parent
a7954b42d0
commit
6f83bd0e2a
4 changed files with 488 additions and 634 deletions
|
@ -56,6 +56,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testjoystick", "tests\testj
|
|||
{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} = {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testoverlay2", "tests\testoverlay2\testoverlay2_VS2010.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08AAD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} = {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -214,6 +221,14 @@ Global
|
|||
{55812185-D13C-4022-9C81-32E0F4A08BCC}.Release|Win32.Build.0 = Release|Win32
|
||||
{55812185-D13C-4022-9C81-32E0F4A08BCC}.Release|x64.ActiveCfg = Release|x64
|
||||
{55812185-D13C-4022-9C81-32E0F4A08BCC}.Release|x64.Build.0 = Release|x64
|
||||
{55812185-D13C-4022-9C81-32E0F4A08AAD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{55812185-D13C-4022-9C81-32E0F4A08AAD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{55812185-D13C-4022-9C81-32E0F4A08AAD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{55812185-D13C-4022-9C81-32E0F4A08AAD}.Debug|x64.Build.0 = Debug|x64
|
||||
{55812185-D13C-4022-9C81-32E0F4A08AAD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{55812185-D13C-4022-9C81-32E0F4A08AAD}.Release|Win32.Build.0 = Release|Win32
|
||||
{55812185-D13C-4022-9C81-32E0F4A08AAD}.Release|x64.ActiveCfg = Release|x64
|
||||
{55812185-D13C-4022-9C81-32E0F4A08AAD}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -235,5 +250,6 @@ Global
|
|||
{55812185-D13C-4022-9C81-32E0F4A08336} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{55812185-D13C-4022-9C81-32E0F4A08996} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{55812185-D13C-4022-9C81-32E0F4A08BCC} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{55812185-D13C-4022-9C81-32E0F4A08AAD} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
copy "$(SolutionDir)\..\test\moose.dat" "$(TargetDir)\moose.dat"</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Message>Copy SDL</Message>
|
||||
<Message>Copy SDL and data files</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -180,7 +180,7 @@ copy "$(SolutionDir)\..\test\moose.dat" "$(TargetDir)\moose.dat"</Command>
|
|||
copy "$(SolutionDir)\..\test\moose.dat" "$(TargetDir)\moose.dat"</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Message>Copy SDL</Message>
|
||||
<Message>Copy SDL and data files</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -215,7 +215,7 @@ copy "$(SolutionDir)\..\test\moose.dat" "$(TargetDir)\moose.dat"</Command>
|
|||
copy "$(SolutionDir)\..\test\moose.dat" "$(TargetDir)\moose.dat"</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Message>Copy SDL</Message>
|
||||
<Message>Copy SDL and data files</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -16,15 +16,6 @@
|
|||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#if 1 /* FIXME: Rework this using the 2.0 API */
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("FIXME\n");
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -215,135 +206,6 @@ ConvertRGBtoYV12(Uint8 *rgb, Uint8 *out, int w, int h,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ConvertRGBtoIYUV(SDL_Surface * s, SDL_Overlay * o, int monochrome,
|
||||
int luminance)
|
||||
{
|
||||
int x, y;
|
||||
int yuv[3];
|
||||
Uint8 *p, *op[3];
|
||||
|
||||
SDL_LockSurface(s);
|
||||
SDL_LockYUVOverlay(o);
|
||||
|
||||
/* Convert */
|
||||
for (y = 0; y < s->h && y < o->h; y++) {
|
||||
p = ((Uint8 *) s->pixels) + s->pitch * y;
|
||||
op[0] = o->pixels[0] + o->pitches[0] * y;
|
||||
op[1] = o->pixels[1] + o->pitches[1] * (y / 2);
|
||||
op[2] = o->pixels[2] + o->pitches[2] * (y / 2);
|
||||
for (x = 0; x < s->w && x < o->w; x++) {
|
||||
RGBtoYUV(p, yuv, monochrome, luminance);
|
||||
*(op[0]++) = yuv[0];
|
||||
if (x % 2 == 0 && y % 2 == 0) {
|
||||
*(op[1]++) = yuv[1];
|
||||
*(op[2]++) = yuv[2];
|
||||
}
|
||||
p += s->format->BytesPerPixel;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_UnlockYUVOverlay(o);
|
||||
SDL_UnlockSurface(s);
|
||||
}
|
||||
|
||||
void
|
||||
ConvertRGBtoUYVY(SDL_Surface * s, SDL_Overlay * o, int monochrome,
|
||||
int luminance)
|
||||
{
|
||||
int x, y;
|
||||
int yuv[3];
|
||||
Uint8 *p, *op;
|
||||
|
||||
SDL_LockSurface(s);
|
||||
SDL_LockYUVOverlay(o);
|
||||
|
||||
for (y = 0; y < s->h && y < o->h; y++) {
|
||||
p = ((Uint8 *) s->pixels) + s->pitch * y;
|
||||
op = o->pixels[0] + o->pitches[0] * y;
|
||||
for (x = 0; x < s->w && x < o->w; x++) {
|
||||
RGBtoYUV(p, yuv, monochrome, luminance);
|
||||
if (x % 2 == 0) {
|
||||
*(op++) = yuv[1];
|
||||
*(op++) = yuv[0];
|
||||
*(op++) = yuv[2];
|
||||
} else
|
||||
*(op++) = yuv[0];
|
||||
|
||||
p += s->format->BytesPerPixel;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_UnlockYUVOverlay(o);
|
||||
SDL_UnlockSurface(s);
|
||||
}
|
||||
|
||||
void
|
||||
ConvertRGBtoYVYU(SDL_Surface * s, SDL_Overlay * o, int monochrome,
|
||||
int luminance)
|
||||
{
|
||||
int x, y;
|
||||
int yuv[3];
|
||||
Uint8 *p, *op;
|
||||
|
||||
SDL_LockSurface(s);
|
||||
SDL_LockYUVOverlay(o);
|
||||
|
||||
for (y = 0; y < s->h && y < o->h; y++) {
|
||||
p = ((Uint8 *) s->pixels) + s->pitch * y;
|
||||
op = o->pixels[0] + o->pitches[0] * y;
|
||||
for (x = 0; x < s->w && x < o->w; x++) {
|
||||
RGBtoYUV(p, yuv, monochrome, luminance);
|
||||
if (x % 2 == 0) {
|
||||
*(op++) = yuv[0];
|
||||
*(op++) = yuv[2];
|
||||
op[1] = yuv[1];
|
||||
} else {
|
||||
*op = yuv[0];
|
||||
op += 2;
|
||||
}
|
||||
|
||||
p += s->format->BytesPerPixel;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_UnlockYUVOverlay(o);
|
||||
SDL_UnlockSurface(s);
|
||||
}
|
||||
|
||||
void
|
||||
ConvertRGBtoYUY2(SDL_Surface * s, SDL_Overlay * o, int monochrome,
|
||||
int luminance)
|
||||
{
|
||||
int x, y;
|
||||
int yuv[3];
|
||||
Uint8 *p, *op;
|
||||
|
||||
SDL_LockSurface(s);
|
||||
SDL_LockYUVOverlay(o);
|
||||
|
||||
for (y = 0; y < s->h && y < o->h; y++) {
|
||||
p = ((Uint8 *) s->pixels) + s->pitch * y;
|
||||
op = o->pixels[0] + o->pitches[0] * y;
|
||||
for (x = 0; x < s->w && x < o->w; x++) {
|
||||
RGBtoYUV(p, yuv, monochrome, luminance);
|
||||
if (x % 2 == 0) {
|
||||
*(op++) = yuv[0];
|
||||
*(op++) = yuv[1];
|
||||
op[1] = yuv[2];
|
||||
} else {
|
||||
*op = yuv[0];
|
||||
op += 2;
|
||||
}
|
||||
|
||||
p += s->format->BytesPerPixel;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_UnlockYUVOverlay(o);
|
||||
SDL_UnlockSurface(s);
|
||||
}
|
||||
|
||||
static void
|
||||
PrintUsage(char *argv0)
|
||||
{
|
||||
|
@ -384,7 +246,7 @@ main(int argc, char **argv)
|
|||
int scale = 5;
|
||||
SDL_bool done = SDL_FALSE;
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
return 3;
|
||||
}
|
||||
|
@ -414,31 +276,6 @@ main(int argc, char **argv)
|
|||
nodelay = 1;
|
||||
argv += 1;
|
||||
argc -= 1;
|
||||
} else if (strcmp(argv[1], "-format") == 0) {
|
||||
if (argv[2]) {
|
||||
if (!strcmp(argv[2], "YV12"))
|
||||
pixel_format = SDL_PIXELFORMAT_YV12;
|
||||
else if (!strcmp(argv[2], "IYUV"))
|
||||
pixel_format = SDL_PIXELFORMAT_IYUV;
|
||||
else if (!strcmp(argv[2], "YUY2"))
|
||||
pixel_format = SDL_PIXELFORMAT_YUY2;
|
||||
else if (!strcmp(argv[2], "UYVY"))
|
||||
pixel_format = SDL_PIXELFORMAT_UYVY;
|
||||
else if (!strcmp(argv[2], "YVYU"))
|
||||
pixel_format = SDL_PIXELFORMAT_YVYU;
|
||||
else {
|
||||
fprintf(stderr,
|
||||
"The -format option %s is not recognized, see help for info.\n",
|
||||
argv[2]);
|
||||
quit(10);
|
||||
}
|
||||
argv += 2;
|
||||
argc -= 2;
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"The -format option requires an argument, default is YUY2.\n");
|
||||
quit(10);
|
||||
}
|
||||
} else if (strcmp(argv[1], "-scale") == 0) {
|
||||
if (argv[2]) {
|
||||
scale = atoi(argv[2]);
|
||||
|
@ -516,6 +353,8 @@ main(int argc, char **argv)
|
|||
free(RawMooseData);
|
||||
quit(5);
|
||||
}
|
||||
/* Uncomment this to check vertex color with a YUV texture */
|
||||
/*SDL_SetTextureColorMod(MooseTexture, 0xff, 0x80, 0x80);*/
|
||||
|
||||
for (i = 0; i < MOOSEFRAMES_COUNT; i++) {
|
||||
Uint8 MooseFrameRGB[MOOSEFRAME_SIZE*3];
|
||||
|
@ -600,6 +439,5 @@ main(int argc, char **argv)
|
|||
quit(0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue