From a3b37080aa4c709b41f6852df49d4a2d920fc2d0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 23 Jul 2013 12:46:22 -0700 Subject: [PATCH] Finished updating testoverlay2 for the new API and added it to the Visual Studio 2010 projects --- VisualC/SDL/SDL_VS2010.vcxproj | 932 +++++++++--------- VisualC/SDL_VS2010.sln | 16 + .../testoverlay2/testoverlay2_VS2010.vcxproj | 6 +- test/testoverlay2.c | 168 +--- 4 files changed, 488 insertions(+), 634 deletions(-) diff --git a/VisualC/SDL/SDL_VS2010.vcxproj b/VisualC/SDL/SDL_VS2010.vcxproj index 72b111c71..5d576b8b9 100644 --- a/VisualC/SDL/SDL_VS2010.vcxproj +++ b/VisualC/SDL/SDL_VS2010.vcxproj @@ -1,466 +1,466 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - SDL2 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} - SDL - - - - DynamicLibrary - false - - - DynamicLibrary - false - - - DynamicLibrary - false - - - DynamicLibrary - false - MultiByte - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories);"$(DXSDK_DIR)\Include"; - _DEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - false - - - Level3 - true - EditAndContinue - Default - false - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - winmm.lib;imm32.lib;oleaut32.lib;version.lib;%(AdditionalDependencies) - true - true - Windows - false - $(DXSDK_DIR)\lib\x86 - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - X64 - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories);"$(DXSDK_DIR)\Include"; - _DEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - false - - - Level3 - EditAndContinue - false - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - winmm.lib;imm32.lib;oleaut32.lib;version.lib;%(AdditionalDependencies) - true - true - Windows - false - $(DXSDK_DIR)\lib\x64 - - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - - - OnlyExplicitInline - false - ..\..\include;%(AdditionalIncludeDirectories);"$(DXSDK_DIR)\Include"; - NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - false - true - - - Level3 - true - Default - false - ProgramDatabase - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - winmm.lib;imm32.lib;oleaut32.lib;version.lib;%(AdditionalDependencies) - true - Windows - $(DXSDK_DIR)\lib\x86 - true - true - true - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - X64 - - - OnlyExplicitInline - false - ..\..\include;%(AdditionalIncludeDirectories);"$(DXSDK_DIR)\Include"; - NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - false - true - - - Level3 - false - ProgramDatabase - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - winmm.lib;imm32.lib;oleaut32.lib;version.lib;%(AdditionalDependencies) - true - Windows - $(DXSDK_DIR)\lib\x64 - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + SDL2 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + SDL + + + + DynamicLibrary + false + + + DynamicLibrary + false + + + DynamicLibrary + false + + + DynamicLibrary + false + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + + + Disabled + ..\..\include;%(AdditionalIncludeDirectories);"$(DXSDK_DIR)\Include"; + _DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + false + + + Level3 + true + EditAndContinue + Default + false + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + winmm.lib;imm32.lib;oleaut32.lib;version.lib;%(AdditionalDependencies) + true + true + Windows + false + $(DXSDK_DIR)\lib\x86 + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + X64 + + + Disabled + ..\..\include;%(AdditionalIncludeDirectories);"$(DXSDK_DIR)\Include"; + _DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + false + + + Level3 + EditAndContinue + false + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + winmm.lib;imm32.lib;oleaut32.lib;version.lib;%(AdditionalDependencies) + true + true + Windows + false + $(DXSDK_DIR)\lib\x64 + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + + + OnlyExplicitInline + false + ..\..\include;%(AdditionalIncludeDirectories);"$(DXSDK_DIR)\Include"; + NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + + + Level3 + true + Default + false + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + winmm.lib;imm32.lib;oleaut32.lib;version.lib;%(AdditionalDependencies) + true + Windows + $(DXSDK_DIR)\lib\x86 + true + true + true + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + + + OnlyExplicitInline + false + ..\..\include;%(AdditionalIncludeDirectories);"$(DXSDK_DIR)\Include"; + NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + + + Level3 + false + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + winmm.lib;imm32.lib;oleaut32.lib;version.lib;%(AdditionalDependencies) + true + Windows + $(DXSDK_DIR)\lib\x64 + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/VisualC/SDL_VS2010.sln b/VisualC/SDL_VS2010.sln index d3274dada..fb5d873f2 100644 --- a/VisualC/SDL_VS2010.sln +++ b/VisualC/SDL_VS2010.sln @@ -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 diff --git a/VisualC/tests/testoverlay2/testoverlay2_VS2010.vcxproj b/VisualC/tests/testoverlay2/testoverlay2_VS2010.vcxproj index 201e32570..86a73edb9 100644 --- a/VisualC/tests/testoverlay2/testoverlay2_VS2010.vcxproj +++ b/VisualC/tests/testoverlay2/testoverlay2_VS2010.vcxproj @@ -109,7 +109,7 @@ copy "$(SolutionDir)\..\test\moose.dat" "$(TargetDir)\moose.dat" - Copy SDL + Copy SDL and data files @@ -180,7 +180,7 @@ copy "$(SolutionDir)\..\test\moose.dat" "$(TargetDir)\moose.dat" copy "$(SolutionDir)\..\test\moose.dat" "$(TargetDir)\moose.dat" - Copy SDL + Copy SDL and data files @@ -215,7 +215,7 @@ copy "$(SolutionDir)\..\test\moose.dat" "$(TargetDir)\moose.dat" copy "$(SolutionDir)\..\test\moose.dat" "$(TargetDir)\moose.dat" - Copy SDL + Copy SDL and data files diff --git a/test/testoverlay2.c b/test/testoverlay2.c index 477720930..9d3cf1bf2 100644 --- a/test/testoverlay2.c +++ b/test/testoverlay2.c @@ -16,15 +16,6 @@ * * ********************************************************************************/ -#if 1 /* FIXME: Rework this using the 2.0 API */ -#include - -int main(int argc, char *argv[]) -{ - printf("FIXME\n"); - return 0; -} -#else #include #include #include @@ -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: */