Rename the OutputAlphaFormat enums; they had gotten inconsistent after the last alpha...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 2 Feb 2013 01:18:22 +0000 (02:18 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 2 Feb 2013 01:18:22 +0000 (02:18 +0100)
alpha_multiplication_effect_test.cpp
demo.cpp
effect_chain.cpp
effect_chain.h
effect_chain_test.cpp
padding_effect_test.cpp
test_util.h

index eab4b25..6ee4289 100644 (file)
@@ -17,7 +17,7 @@ TEST(AlphaMultiplicationEffectTest, SimpleTest) {
        };
        float out_data[4 * size];
        EffectChainTester tester(data, 1, size, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_LINEAR);
-       tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_PREMULTIPLIED);
+       tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
 
        expect_equal(expected_data, out_data, 4, size);
 }
index 298b536..7b31528 100644 (file)
--- a/demo.cpp
+++ b/demo.cpp
@@ -196,7 +196,7 @@ int main(int argc, char **argv)
        //Effect *sandbox_effect = chain.add_effect(new SandboxEffect());
        //sandbox_effect->set_float("parm", 42.0f);
        //chain.add_effect(new MirrorEffect());
-       chain.add_output(inout_format, OUTPUT_POSTMULTIPLIED_ALPHA);
+       chain.add_output(inout_format, OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED);
        chain.set_dither_bits(8);
        chain.finalize();
 
index c04e34d..bd039b0 100644 (file)
@@ -1141,14 +1141,14 @@ void EffectChain::fix_output_alpha()
                return;
        }
        if (output->output_alpha_type == ALPHA_PREMULTIPLIED &&
-           output_alpha_format == OUTPUT_POSTMULTIPLIED_ALPHA) {
+           output_alpha_format == OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED) {
                Node *conversion = add_node(new AlphaDivisionEffect());
                connect_nodes(output, conversion);
                propagate_alpha();
                propagate_gamma_and_color_space();
        }
        if (output->output_alpha_type == ALPHA_POSTMULTIPLIED &&
-           output_alpha_format == OUTPUT_ALPHA_PREMULTIPLIED) {
+           output_alpha_format == OUTPUT_ALPHA_FORMAT_PREMULTIPLIED) {
                Node *conversion = add_node(new AlphaMultiplicationEffect());
                connect_nodes(output, conversion);
                propagate_alpha();
index f5064eb..f5e27c8 100644 (file)
@@ -22,8 +22,8 @@ enum AlphaType {
 // Whether you want pre- or postmultiplied alpha in the output
 // (see effect.h for a discussion of pre- versus postmultiplied alpha).
 enum OutputAlphaFormat {
-       OUTPUT_ALPHA_PREMULTIPLIED,
-       OUTPUT_POSTMULTIPLIED_ALPHA,
+       OUTPUT_ALPHA_FORMAT_PREMULTIPLIED,
+       OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED,
 };
 
 // A node in the graph; basically an effect and some associated information.
index 5fa81d3..e7f25e5 100644 (file)
@@ -439,7 +439,7 @@ TEST(EffectChainTest, NoAlphaConversionsWithBlankAlpha) {
        EffectChainTester tester(NULL, size, 1);
        RewritingToBlueInput *input = new RewritingToBlueInput();
        tester.get_chain()->add_input(input);
-       tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_PREMULTIPLIED);
+       tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
 
        Node *node = input->blue_node;
        EXPECT_EQ(0, node->incoming_links.size());
index 1d2be79..e3f6f41 100644 (file)
@@ -34,7 +34,7 @@ TEST(PaddingEffectTest, SimpleCenter) {
        CHECK(effect->set_float("left", 1.0f));
        CHECK(effect->set_float("top", 1.0f));
 
-       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_PREMULTIPLIED);
+       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
        expect_equal(expected_data, out_data, 4, 4);
 }
 
@@ -70,7 +70,7 @@ TEST(PaddingEffectTest, WhiteBorderColor) {
        RGBATriplet border_color(1.0f, 1.0f, 1.0f, 1.0f);
        CHECK(effect->set_vec4("border_color", (float *)&border_color));
 
-       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_PREMULTIPLIED);
+       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
        expect_equal(expected_data, out_data, 4, 4);
 }
 
@@ -103,7 +103,7 @@ TEST(PaddingEffectTest, BorderColorIsInLinearGamma) {
        RGBATriplet border_color(0.2f, 0.4f, 0.6f, 0.8f);  // Same as the pixel in data[].
        CHECK(effect->set_vec4("border_color", (float *)&border_color));
 
-       tester.run(out_data, GL_RGBA, COLORSPACE_REC_601_625, GAMMA_REC_601, OUTPUT_POSTMULTIPLIED_ALPHA);
+       tester.run(out_data, GL_RGBA, COLORSPACE_REC_601_625, GAMMA_REC_601, OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED);
        expect_equal(expected_data, out_data, 4, 2);
 }
 
@@ -134,7 +134,7 @@ TEST(PaddingEffectTest, DifferentXAndYOffset) {
        CHECK(effect->set_float("left", 2.0f));
        CHECK(effect->set_float("top", 1.0f));
 
-       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_PREMULTIPLIED);
+       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
        expect_equal(expected_data, out_data, 3, 3);
 }
 
@@ -166,7 +166,7 @@ TEST(PaddingEffectTest, NonIntegerOffset) {
        CHECK(effect->set_float("left", 0.25f));
        CHECK(effect->set_float("top", 0.0f));
 
-       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_PREMULTIPLIED);
+       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
        expect_equal(expected_data, out_data, 5, 2);
 }
 
@@ -196,6 +196,6 @@ TEST(PaddingEffectTest, Crop) {
        CHECK(effect->set_float("left", -1.0f));
        CHECK(effect->set_float("top", -1.0f));
 
-       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_PREMULTIPLIED);
+       tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR, OUTPUT_ALPHA_FORMAT_PREMULTIPLIED);
        expect_equal(expected_data, out_data, 1, 1);
 }
index eca6b6a..9a7d001 100644 (file)
@@ -15,8 +15,8 @@ public:
        EffectChain *get_chain() { return &chain; }
        Input *add_input(const float *data, MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve);
        Input *add_input(const unsigned char *data, MovitPixelFormat pixel_format, Colorspace color_space, GammaCurve gamma_curve);
-       void run(float *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format = OUTPUT_POSTMULTIPLIED_ALPHA);
-       void run(unsigned char *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format = OUTPUT_POSTMULTIPLIED_ALPHA);
+       void run(float *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format = OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED);
+       void run(unsigned char *out_data, GLenum format, Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format = OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED);
 
 private:
        void finalize_chain(Colorspace color_space, GammaCurve gamma_curve, OutputAlphaFormat alpha_format);