} // namespace
ResampleEffect::ResampleEffect()
- : input_width(1280),
+ : owns_effects(true),
+ input_width(1280),
input_height(720),
offset_x(0.0f), offset_y(0.0f),
zoom_x(1.0f), zoom_y(1.0f),
update_size();
}
+ResampleEffect::~ResampleEffect()
+{
+ if (owns_effects) {
+ delete hpass;
+ delete vpass;
+ }
+}
+
void ResampleEffect::rewrite_graph(EffectChain *graph, Node *self)
{
Node *hpass_node = graph->add_node(hpass);
graph->replace_receiver(self, hpass_node);
graph->replace_sender(self, vpass_node);
self->disabled = true;
+ owns_effects = false;
}
// We get this information forwarded from the first blur pass,
class ResampleEffect : public Effect {
public:
ResampleEffect();
+ ~ResampleEffect();
virtual std::string effect_type_id() const { return "ResampleEffect"; }
void update_size();
void update_offset_and_zoom();
+ // Both of these are owned by us if owns_effects is true (before finalize()),
+ // and otherwise owned by the EffectChain.
+ bool owns_effects;
SingleResamplePassEffect *hpass, *vpass;
int input_width, input_height, output_width, output_height;