]> git.sesse.net Git - movit/blob - glow_effect.cpp
Deallocation in YCbCrInput.
[movit] / glow_effect.cpp
1 #include <math.h>
2 #include <assert.h>
3
4 #include "glow_effect.h"
5 #include "blur_effect.h"
6 #include "mix_effect.h"
7 #include "effect_chain.h"
8 #include "util.h"
9
10 GlowEffect::GlowEffect()
11         : blur(new BlurEffect),
12           mix(new MixEffect)
13 {
14         mix->set_float("strength_first", 1.0f);
15         mix->set_float("strength_second", 0.3f);
16 }
17
18 void GlowEffect::rewrite_graph(EffectChain *graph, Node *self)
19 {
20         assert(self->incoming_links.size() == 1);
21         Node *input = self->incoming_links[0];
22
23         Node *blur_node = graph->add_node(blur);
24         Node *mix_node = graph->add_node(mix);
25         graph->replace_receiver(self, mix_node);
26         graph->connect_nodes(input, blur_node);
27         graph->connect_nodes(blur_node, mix_node);
28         graph->replace_sender(self, mix_node);
29
30         self->disabled = true;
31 }
32
33 bool GlowEffect::set_float(const std::string &key, float value) {
34         if (key == "blurred_mix_amount") {
35                 return mix->set_float("strength_second", value);
36         }
37         return blur->set_float(key, value);
38 }