If there's no context we're using the simple API functions - fall back to malloc and free.
This commit is contained in:
parent
36db03f390
commit
8cc6a3abfc
@ -33,7 +33,7 @@ public:
|
|||||||
void* stbir_malloc(void* context, size_t size)
|
void* stbir_malloc(void* context, size_t size)
|
||||||
{
|
{
|
||||||
if (!context)
|
if (!context)
|
||||||
return 0;
|
return malloc(size);
|
||||||
|
|
||||||
stbir_context* real_context = (stbir_context*)context;
|
stbir_context* real_context = (stbir_context*)context;
|
||||||
if (size > real_context->size)
|
if (size > real_context->size)
|
||||||
@ -44,6 +44,8 @@ void* stbir_malloc(void* context, size_t size)
|
|||||||
|
|
||||||
void stbir_free(void* context, void* memory)
|
void stbir_free(void* context, void* memory)
|
||||||
{
|
{
|
||||||
|
if (!context)
|
||||||
|
return free(memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stbir_progress(float p)
|
void stbir_progress(float p)
|
||||||
@ -645,6 +647,19 @@ void test_suite(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#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_filters();
|
||||||
|
|
||||||
test_subpixel_1();
|
test_subpixel_1();
|
||||||
|
Loading…
Reference in New Issue
Block a user