X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=effect_chain.cpp;h=270eae6c4ce9bd7933c46f3f3ffae1ce4e4ac27b;hb=b65675827bcaaa8cd913e46a7210575183d0056f;hp=85c8be374a0702118c74ce2faa3c9c5e6d175674;hpb=3dbe1e7c09766c2437d92a8c2cbbaeea7de3f610;p=movit diff --git a/effect_chain.cpp b/effect_chain.cpp index 85c8be3..270eae6 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -64,7 +64,7 @@ void EffectChain::normalize_to_linear_gamma() } else { GammaExpansionEffect *gamma_conversion = new GammaExpansionEffect(); gamma_conversion->set_int("source_curve", current_gamma_curve); - effects.push_back(gamma_conversion); + gamma_conversion->add_self_to_effect_chain(&effects); } current_gamma_curve = GAMMA_LINEAR; } @@ -75,7 +75,7 @@ void EffectChain::normalize_to_srgb() ColorSpaceConversionEffect *colorspace_conversion = new ColorSpaceConversionEffect(); colorspace_conversion->set_int("source_space", current_color_space); colorspace_conversion->set_int("destination_space", COLORSPACE_sRGB); - effects.push_back(colorspace_conversion); + colorspace_conversion->add_self_to_effect_chain(&effects); current_color_space = COLORSPACE_sRGB; } @@ -91,7 +91,7 @@ Effect *EffectChain::add_effect(EffectId effect_id) normalize_to_srgb(); } - effects.push_back(effect); + effect->add_self_to_effect_chain(&effects); return effect; } @@ -220,8 +220,6 @@ void EffectChain::finalize() unsigned num_textures = std::max(phases.size() - 1, 2); glGenTextures(num_textures, temp_textures); - unsigned char *empty = new unsigned char[width * height * 4]; - memset(empty, 0, width * height * 4); for (unsigned i = 0; i < num_textures; ++i) { glBindTexture(GL_TEXTURE_2D, temp_textures[i]); check_error(); @@ -229,10 +227,9 @@ void EffectChain::finalize() check_error(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); check_error(); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, empty); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); check_error(); } - delete[] empty; } // Translate the input format to OpenGL's enums.