make resample tests work in VC6

This commit is contained in:
Sean Barrett
2014-08-18 08:56:44 -07:00
parent fc09a5d198
commit 9ba3dc1fc5
4 changed files with 254 additions and 155 deletions

View File

@ -1,7 +1,8 @@
#ifdef _WIN32
#if defined(_WIN32) && _MSC_VER > 1200
#define STBR_ASSERT(x) \
if (!(x)) \
__debugbreak();
if (!(x)) { \
__debugbreak(); \
} else
#else
#include <assert.h>
#define STBR_ASSERT(x) assert(x)
@ -407,11 +408,11 @@ void test_subpixel_2()
stbr_resize_arbitrary(image, 8, 8, 0, output_data_1, 16, 16, 0, 0, 0, 1, 1, 1, -1, 0, STBR_TYPE_UINT8, STBR_FILTER_CATMULLROM, STBR_EDGE_WRAP, STBR_EDGE_WRAP, STBR_COLORSPACE_SRGB);
stbr_resize_arbitrary(large_image, 32, 32, 0, output_data_2, 16, 16, 0, 0.25f, 0.25f, 0.5f, 0.5f, 1, -1, 0, STBR_TYPE_UINT8, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, STBR_EDGE_CLAMP, STBR_COLORSPACE_SRGB);
for (int x = 0; x < 16; x++)
{for (int x = 0; x < 16; x++)
{
for (int y = 0; y < 16; y++)
STBR_ASSERT(output_data_1[y * 16 + x] == output_data_2[y * 16 + x]);
}
}}
}
void test_subpixel_3()
@ -453,6 +454,8 @@ void test_subpixel_4()
void test_suite()
{
int i;
test_subpixel_1();
test_subpixel_2();
test_subpixel_3();
@ -460,16 +463,16 @@ void test_suite()
test_premul("barbara.png");
for (int i = 0; i < 10; i++)
for (i = 0; i < 10; i++)
test_subpixel("barbara.png", 0.5f, 0.5f, (float)i / 10, 1);
for (int i = 0; i < 10; i++)
for (i = 0; i < 10; i++)
test_subpixel("barbara.png", 0.5f, 0.5f, 1, (float)i / 10);
for (int i = 0; i < 10; i++)
for (i = 0; i < 10; i++)
test_subpixel("barbara.png", 2, 2, (float)i / 10, 1);
for (int i = 0; i < 10; i++)
for (i = 0; i < 10; i++)
test_subpixel("barbara.png", 2, 2, 1, (float)i / 10);
// Channels test
@ -511,35 +514,35 @@ void test_suite()
resize_image("barbara.png", 0.5f, 0.5f, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, STBR_COLORSPACE_SRGB, "test-output/barbara-downsample-catmullrom.png");
resize_image("barbara.png", 0.5f, 0.5f, STBR_FILTER_MITCHELL, STBR_EDGE_CLAMP, STBR_COLORSPACE_SRGB, "test-output/barbara-downsample-mitchell.png");
for (int i = 10; i < 100; i++)
for (i = 10; i < 100; i++)
{
char outname[200];
sprintf(outname, "test-output/barbara-width-%d.jpg", i);
resize_image("barbara.png", (float)i / 100, 1, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, STBR_COLORSPACE_SRGB, outname);
}
for (int i = 110; i < 500; i += 10)
for (i = 110; i < 500; i += 10)
{
char outname[200];
sprintf(outname, "test-output/barbara-width-%d.jpg", i);
resize_image("barbara.png", (float)i / 100, 1, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, STBR_COLORSPACE_SRGB, outname);
}
for (int i = 10; i < 100; i++)
for (i = 10; i < 100; i++)
{
char outname[200];
sprintf(outname, "test-output/barbara-height-%d.jpg", i);
resize_image("barbara.png", 1, (float)i / 100, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, STBR_COLORSPACE_SRGB, outname);
}
for (int i = 110; i < 500; i += 10)
for (i = 110; i < 500; i += 10)
{
char outname[200];
sprintf(outname, "test-output/barbara-height-%d.jpg", i);
resize_image("barbara.png", 1, (float)i / 100, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, STBR_COLORSPACE_SRGB, outname);
}
for (int i = 50; i < 200; i += 10)
for (i = 50; i < 200; i += 10)
{
char outname[200];
sprintf(outname, "test-output/barbara-width-height-%d.jpg", i);

88
tests/resize.dsp Normal file
View File

@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="resize" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=resize - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "resize.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "resize.mak" CFG="resize - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "resize - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "resize - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "resize - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "resize - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "resize - Win32 Release"
# Name "resize - Win32 Debug"
# Begin Source File
SOURCE=..\resample_test.cpp
# End Source File
# End Target
# End Project

View File

@ -63,6 +63,18 @@ Package=<4>
###############################################################################
Project: "resize"=.\resize\resize.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "stb"=.\stb.dsp - Package Owner=<4>
Package=<5>