]> git.sesse.net Git - movit/blobdiff - padding_effect.cpp
In resizing effects, add the notion of a “virtual output size”.
[movit] / padding_effect.cpp
index 9d6e292996f33aca18062597de166766d90a9550..c06a1ac49ef03b36cfa5ad338c71205aeb80d0b8 100644 (file)
@@ -46,14 +46,14 @@ void PaddingEffect::set_gl_state(GLuint glsl_program_num, const std::string &pre
        // than losing a pixel in the common cases of integer shift.
        // Thus the 1e-3 fudge factors.
        float texcoord_min[2] = {
-               (0.5f - 1e-3) / input_width,
-               (0.5f - 1e-3) / input_height
+               float((0.5f - 1e-3) / input_width),
+               float((0.5f - 1e-3) / input_height)
        };
        set_uniform_vec2(glsl_program_num, prefix, "texcoord_min", texcoord_min);
 
        float texcoord_max[2] = {
-               1.0f - (0.5f - 1e-3) / input_width,
-               1.0f - (0.5f - 1e-3) / input_height
+               float(1.0f - (0.5f - 1e-3) / input_width),
+               float(1.0f - (0.5f - 1e-3) / input_height)
        };
        set_uniform_vec2(glsl_program_num, prefix, "texcoord_max", texcoord_max);
 }
@@ -99,10 +99,10 @@ Effect::AlphaHandling PaddingEffect::alpha_handling() const
        return INPUT_AND_OUTPUT_ALPHA_PREMULTIPLIED;
 }
        
-void PaddingEffect::get_output_size(unsigned *width, unsigned *height) const
+void PaddingEffect::get_output_size(unsigned *width, unsigned *height, unsigned *virtual_width, unsigned *virtual_height) const
 {
-       *width = output_width;
-       *height = output_height;
+       *virtual_width = *width = output_width;
+       *virtual_height = *height = output_height;
 }
        
 void PaddingEffect::inform_input_size(unsigned input_num, unsigned width, unsigned height)