X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=dither_effect.h;h=20fb025532d5fea4e92329c7733d06669354b39d;hp=943220aed55ad3dc524e4404b06ef2838f917831;hb=45955bca8c14dd8cac4fa922e45fb0f8be507d58;hpb=f1a81dca72da9aa5103527b8c9494381204e70c5 diff --git a/dither_effect.h b/dither_effect.h index 943220a..20fb025 100644 --- a/dither_effect.h +++ b/dither_effect.h @@ -1,5 +1,5 @@ -#ifndef _DITHER_EFFECT_H -#define _DITHER_EFFECT_H 1 +#ifndef _MOVIT_DITHER_EFFECT_H +#define _MOVIT_DITHER_EFFECT_H 1 // Implements simple rectangular-PDF dither. // @@ -43,15 +43,30 @@ // like many LCD monitors do, but it starts to get very hairy, again, for limited gains.) // The dither is also deterministic across runs. +#include +#include + #include "effect.h" +namespace movit { + class DitherEffect : public Effect { -public: +private: + // Should not be instantiated by end users; + // call EffectChain::set_dither_bits() instead. DitherEffect(); + friend class EffectChain; + +public: ~DitherEffect(); virtual std::string effect_type_id() const { return "DitherEffect"; } std::string output_fragment_shader(); + // Note that if we did error diffusion, we'd actually want to diffuse the + // premultiplied error. However, we need to do dithering in the same + // space as quantization, whether that be pre- or postmultiply. + virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; } + void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num); private: @@ -62,7 +77,8 @@ private: int texture_width, texture_height; GLuint texnum; - bool need_texture_update; }; -#endif // !defined(_DITHER_EFFECT_H) +} // namespace movit + +#endif // !defined(_MOVIT_DITHER_EFFECT_H)