]> git.sesse.net Git - movit/blobdiff - padding_effect.cpp
Fix a bug where PaddingEffect could create assertion errors.
[movit] / padding_effect.cpp
index f7f97078e608749ab1a70db4226e2984be6281fb..00d475ac2fb23995780920569ee09203abb91177 100644 (file)
@@ -1,6 +1,7 @@
 #include <GL/glew.h>
 #include <assert.h>
 
+#include "effect_util.h"
 #include "padding_effect.h"
 #include "util.h"
 
@@ -63,12 +64,16 @@ void PaddingEffect::set_gl_state(GLuint glsl_program_num, const std::string &pre
 // differently in different modes.
 
 // 0.0 and 1.0 are interpreted the same, no matter the gamma ramp.
-// Alpha is not affected by gamma.
+// Alpha is not affected by gamma per se, but the combination of
+// premultiplied alpha and non-linear gamma curve does not make sense,
+// so if could possibly be converting blank alpha to non-blank
+// (ie., premultiplied), we need our output to be in linear light.
 bool PaddingEffect::needs_linear_light() const
 {
        if ((border_color.r == 0.0 || border_color.r == 1.0) &&
            (border_color.g == 0.0 || border_color.g == 1.0) &&
-           (border_color.b == 0.0 || border_color.b == 1.0)) {
+           (border_color.b == 0.0 || border_color.b == 1.0) &&
+           border_color.a == 1.0) {
                return false;
        }
        return true;