]> git.sesse.net Git - movit/blobdiff - flat_input.frag
Stop using BGR, BGRA and grayscale formats.
[movit] / flat_input.frag
index 4bc055e8baec0a00f2552cea2bc65bc732e04ad8..007675e848fc08aec4ced29015ad61a078ae4b6c 100644 (file)
@@ -4,7 +4,19 @@ vec4 FUNCNAME(vec2 tc) {
        // OpenGL's origin is bottom-left, but most graphics software assumes
        // a top-left origin. Thus, for inputs that come from the user,
        // we flip the y coordinate.
-       tc.y = 1.0f - tc.y;
+       tc.y = 1.0 - tc.y;
 
-       return texture2D(PREFIX(tex), tc);
+       vec4 pixel = texture2D(PREFIX(tex), tc);
+
+       // These two are #defined to 0 or 1 in flat_input.cpp.
+#if FIXUP_SWAP_RB
+       pixel.rb = pixel.br;
+#endif
+#if FIXUP_RED_TO_GRAYSCALE
+       pixel.gb = pixel.rr;
+#endif
+       return pixel;
 }
+
+#undef FIXUP_SWAP_RB
+#undef FIXUP_RED_TO_GRAYSCALE