X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=test_util.cpp;h=3aecd54463a9c6213e53e22dcbf26122ae64ff68;hp=cd79bd7c5adc973c1c29ea58449a8d5434878292;hb=3140175e3160e75d659e596e420afffb596e3c2c;hpb=ed30033a26851b96c2c3a0ed2a5751446038fcc3;ds=sidebyside diff --git a/test_util.cpp b/test_util.cpp index cd79bd7..3aecd54 100644 --- a/test_util.cpp +++ b/test_util.cpp @@ -106,6 +106,24 @@ void EffectChainTester::run(float *out_data, GLenum format, Colorspace color_spa vertical_flip(out_data, width, height); } +void EffectChainTester::run(unsigned char *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve) +{ + if (!finalized) { + finalize_chain(color_space, gamma_curve); + } + + chain.render_to_fbo(fbo, width, height); + + glBindFramebuffer(GL_FRAMEBUFFER, fbo); + glReadPixels(0, 0, width, height, format, GL_UNSIGNED_BYTE, out_data); + + if (format == GL_RGBA) { + width *= 4; + } + + vertical_flip(out_data, width, height); +} + void EffectChainTester::finalize_chain(Colorspace color_space, GammaCurve gamma_curve) { assert(!finalized);