diff --git a/tests/resample_test.cpp b/tests/resample_test.cpp index 5980c3f..5ec6f2c 100644 --- a/tests/resample_test.cpp +++ b/tests/resample_test.cpp @@ -33,7 +33,7 @@ public: void* stbir_malloc(void* context, size_t size) { if (!context) - return 0; + return malloc(size); stbir_context* real_context = (stbir_context*)context; if (size > real_context->size) @@ -44,6 +44,8 @@ void* stbir_malloc(void* context, size_t size) void stbir_free(void* context, void* memory) { + if (!context) + return free(memory); } void stbir_progress(float p) @@ -645,6 +647,19 @@ void test_suite(int argc, char **argv) } #endif + /*resize_image("white-stripes.png", 0.5f, 0.5f, STBIR_FILTER_BOX, STBIR_EDGE_WRAP, STBIR_COLORSPACE_LINEAR, "test-output/white-stripes-down-50-nearest.png"); + resize_image("white-stripes.png", 0.5f, 0.5f, STBIR_FILTER_BILINEAR, STBIR_EDGE_WRAP, STBIR_COLORSPACE_LINEAR, "test-output/white-stripes-down-50-bilinear.png"); + resize_image("white-stripes.png", 0.5f, 0.5f, STBIR_FILTER_BICUBIC, STBIR_EDGE_WRAP, STBIR_COLORSPACE_LINEAR, "test-output/white-stripes-down-50-bicubic.png"); + resize_image("white-stripes.png", 0.5f, 0.5f, STBIR_FILTER_MITCHELL, STBIR_EDGE_WRAP, STBIR_COLORSPACE_LINEAR, "test-output/white-stripes-down-50-mitchell.png"); + resize_image("white-stripes.png", 0.5f, 0.5f, STBIR_FILTER_CATMULLROM, STBIR_EDGE_WRAP, STBIR_COLORSPACE_LINEAR, "test-output/white-stripes-down-50-catmullrom.png"); + + resize_image("white-stripes.png", 0.25f, 0.25f, STBIR_FILTER_BOX, STBIR_EDGE_WRAP, STBIR_COLORSPACE_LINEAR, "test-output/white-stripes-down-25-nearest.png"); + resize_image("white-stripes.png", 0.25f, 0.25f, STBIR_FILTER_BILINEAR, STBIR_EDGE_WRAP, STBIR_COLORSPACE_LINEAR, "test-output/white-stripes-down-25-bilinear.png"); + resize_image("white-stripes.png", 0.25f, 0.25f, STBIR_FILTER_BICUBIC, STBIR_EDGE_WRAP, STBIR_COLORSPACE_LINEAR, "test-output/white-stripes-down-25-bicubic.png"); + resize_image("white-stripes.png", 0.25f, 0.25f, STBIR_FILTER_MITCHELL, STBIR_EDGE_WRAP, STBIR_COLORSPACE_LINEAR, "test-output/white-stripes-down-25-mitchell.png"); + resize_image("white-stripes.png", 0.25f, 0.25f, STBIR_FILTER_CATMULLROM, STBIR_EDGE_WRAP, STBIR_COLORSPACE_LINEAR, "test-output/white-stripes-down-25-catmullrom.png"); + + return;*/ test_filters(); test_subpixel_1();