DiffusionEffect::DiffusionEffect()
: blur(new BlurEffect),
- overlay_matte(new OverlayMatteEffect)
+ overlay_matte(new OverlayMatteEffect),
+ owns_overlay_matte(true)
{
}
+DiffusionEffect::~DiffusionEffect()
+{
+ if (owns_overlay_matte) {
+ delete overlay_matte;
+ }
+}
+
void DiffusionEffect::rewrite_graph(EffectChain *graph, Node *self)
{
assert(self->incoming_links.size() == 1);
Node *blur_node = graph->add_node(blur);
Node *overlay_matte_node = graph->add_node(overlay_matte);
+ owns_overlay_matte = false;
graph->replace_receiver(self, overlay_matte_node);
graph->connect_nodes(input, blur_node);
graph->connect_nodes(blur_node, overlay_matte_node);
class DiffusionEffect : public Effect {
public:
DiffusionEffect();
+ ~DiffusionEffect();
virtual std::string effect_type_id() const { return "DiffusionEffect"; }
virtual void rewrite_graph(EffectChain *graph, Node *self);
private:
BlurEffect *blur;
OverlayMatteEffect *overlay_matte;
+ bool owns_overlay_matte;
};
// Used internally by DiffusionEffect; combines the blurred and the original