]> git.sesse.net Git - movit/blobdiff - diffusion_effect.h
Convert a loop to range-based for.
[movit] / diffusion_effect.h
index f8ed77c35af528cdb71e896e80522dfa3c270ae8..a8babd0e92a518f0ee58542c6e8d7e63ae2be6a6 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _DIFFUSION_EFFECT_H
-#define _DIFFUSION_EFFECT_H 1
+#ifndef _MOVIT_DIFFUSION_EFFECT_H
+#define _MOVIT_DIFFUSION_EFFECT_H 1
 
 // There are many different effects that go under the name of "diffusion",
 // seemingly all of the inspired by the effect you get when you put a
 // where we first blur the picture, and then overlay it on the original
 // using the original as a matte.
 
+#include <epoxy/gl.h>
+#include <assert.h>
+#include <string>
+
 #include "effect.h"
 
+namespace movit {
+
 class BlurEffect;
+class EffectChain;
+class Node;
 class OverlayMatteEffect;
 
 class DiffusionEffect : public Effect {
 public:
        DiffusionEffect();
-       virtual std::string effect_type_id() const { return "DiffusionEffect"; }
+       ~DiffusionEffect();
+       std::string effect_type_id() const override { return "DiffusionEffect"; }
 
-       virtual void add_self_to_effect_chain(EffectChain *chain, const std::vector<Effect *> &input);
-       virtual bool set_float(const std::string &key, float value);
+       void rewrite_graph(EffectChain *graph, Node *self) override;
+       bool set_float(const std::string &key, float value) override;
        
-       virtual std::string output_fragment_shader() {
+       std::string output_fragment_shader() override {
                assert(false);
        }
-       virtual void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) {
+       void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override {
                assert(false);
        }
 
 private:
        BlurEffect *blur;
        OverlayMatteEffect *overlay_matte;
+       bool owns_overlay_matte;
 };
 
 // Used internally by DiffusionEffect; combines the blurred and the original
@@ -42,14 +52,17 @@ private:
 class OverlayMatteEffect : public Effect {
 public:
        OverlayMatteEffect();
-       virtual std::string effect_type_id() const { return "OverlayMatteEffect"; }
-       std::string output_fragment_shader();
+       std::string effect_type_id() const override { return "OverlayMatteEffect"; }
+       std::string output_fragment_shader() override;
+       AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
 
-       unsigned num_inputs() const { return 2; }
+       unsigned num_inputs() const override { return 2; }
+       bool strong_one_to_one_sampling() const override { return true; }
 
 private:
        float blurred_mix_amount;
 };
 
+}  // namespace movit
 
-#endif // !defined(_DIFFUSION_EFFECT_H)
+#endif // !defined(_MOVIT_DIFFUSION_EFFECT_H)