X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=test_util.cpp;h=f48ff7fffcc8bbd4cf6478b1aec5d12b22ae74f4;hp=ea3a0110ce6e509da802e0d3d9a0eb9deaa1aaf2;hb=de9c0e36aae9272c57596541de19790686669b25;hpb=8ea03db1932e4a76f457e0ecdfe31a4c8be0e0eb diff --git a/test_util.cpp b/test_util.cpp index ea3a011..f48ff7f 100644 --- a/test_util.cpp +++ b/test_util.cpp @@ -59,7 +59,7 @@ EffectChainTester::EffectChainTester(const float *data, unsigned width, unsigned check_error(); glBindTexture(GL_TEXTURE_2D, texnum); check_error(); - glTexImage2D(GL_TEXTURE_2D, 0, framebuffer_format, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, framebuffer_format, width, height, 0, GL_RGBA, GL_FLOAT, NULL); check_error(); glGenFramebuffers(1, &fbo); @@ -85,25 +85,39 @@ EffectChainTester::~EffectChainTester() check_error(); } -Input *EffectChainTester::add_input(const float *data, MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve) +Input *EffectChainTester::add_input(const float *data, MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve, int input_width, int input_height) { ImageFormat format; format.color_space = color_space; format.gamma_curve = gamma_curve; - FlatInput *input = new FlatInput(format, pixel_format, GL_FLOAT, width, height); + if (input_width == -1) { + input_width = width; + } + if (input_height == -1) { + input_height = height; + } + + FlatInput *input = new FlatInput(format, pixel_format, GL_FLOAT, input_width, input_height); input->set_pixel_data(data); chain.add_input(input); return input; } -Input *EffectChainTester::add_input(const unsigned char *data, MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve) +Input *EffectChainTester::add_input(const unsigned char *data, MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve, int input_width, int input_height) { ImageFormat format; format.color_space = color_space; format.gamma_curve = gamma_curve; - FlatInput *input = new FlatInput(format, pixel_format, GL_UNSIGNED_BYTE, width, height); + if (input_width == -1) { + input_width = width; + } + if (input_height == -1) { + input_height = height; + } + + FlatInput *input = new FlatInput(format, pixel_format, GL_UNSIGNED_BYTE, input_width, input_height); input->set_pixel_data(data); chain.add_input(input); return input;