]> git.sesse.net Git - movit/blob - resize_effect.h
Microoptimization in calculate_scaling_weights.
[movit] / resize_effect.h
1 #ifndef _MOVIT_RESIZE_EFFECT_H
2 #define _MOVIT_RESIZE_EFFECT_H 1
3
4 // An effect that simply resizes the picture to a given output size
5 // (set by the two integer parameters "width" and "height").
6 // Mostly useful as part of other algorithms.
7
8 #include <string>
9
10 #include "effect.h"
11
12 namespace movit {
13
14 class ResizeEffect : public Effect {
15 public:
16         ResizeEffect();
17         std::string effect_type_id() const override { return "ResizeEffect"; }
18         std::string output_fragment_shader() override;
19
20         // We want processing done pre-filtering and mipmapped,
21         // in case we need to scale down a lot.
22         bool needs_texture_bounce() const override { return true; }
23         bool needs_mipmaps() const override { return true; }
24         AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
25
26         bool changes_output_size() const override { return true; }
27         bool sets_virtual_output_size() const override { return false; }
28         void get_output_size(unsigned *width, unsigned *height, unsigned *virtual_width, unsigned *virtual_height) const override;
29
30 private:
31         int width, height;
32 };
33
34 }  // namespace movit
35
36 #endif // !defined(_MOVIT_RESIZE_EFFECT_H)