From 38dfb378427d1c97113ad7644c39f7695be84c49 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 20 Jan 2013 02:04:35 +0100 Subject: [PATCH 1/1] Make the internal effects private to EffectChain. ColorspaceConversionEffect, DitherEffect, GammaExpansionEffect and GammaCompressionEffect are all supposed to be used by EffectChain only, so make them private; I've had reports of users trying to use these directly, leaving the framework in a confused state. --- colorspace_conversion_effect.h | 6 +++++- dither_effect.h | 7 ++++++- gamma_compression_effect.h | 6 +++++- gamma_expansion_effect.h | 6 +++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/colorspace_conversion_effect.h b/colorspace_conversion_effect.h index 93db321..15ad0ad 100644 --- a/colorspace_conversion_effect.h +++ b/colorspace_conversion_effect.h @@ -12,8 +12,12 @@ #include "effect_chain.h" class ColorspaceConversionEffect : public Effect { -public: +private: + // Should not be instantiated by end users. ColorspaceConversionEffect(); + friend class EffectChain; + +public: virtual std::string effect_type_id() const { return "ColorspaceConversionEffect"; } std::string output_fragment_shader(); diff --git a/dither_effect.h b/dither_effect.h index 535b783..cad6488 100644 --- a/dither_effect.h +++ b/dither_effect.h @@ -46,8 +46,13 @@ #include "effect.h" 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(); diff --git a/gamma_compression_effect.h b/gamma_compression_effect.h index 0155ee5..2744d2d 100644 --- a/gamma_compression_effect.h +++ b/gamma_compression_effect.h @@ -13,8 +13,12 @@ #define COMPRESSION_CURVE_SIZE 4096 class GammaCompressionEffect : public Effect { -public: +private: + // Should not be instantiated by end users. GammaCompressionEffect(); + friend class EffectChain; + +public: virtual std::string effect_type_id() const { return "GammaCompressionEffect"; } std::string output_fragment_shader(); diff --git a/gamma_expansion_effect.h b/gamma_expansion_effect.h index ce99990..043731b 100644 --- a/gamma_expansion_effect.h +++ b/gamma_expansion_effect.h @@ -13,8 +13,12 @@ #define EXPANSION_CURVE_SIZE 256 class GammaExpansionEffect : public Effect { -public: +private: + // Should not be instantiated by end users. GammaExpansionEffect(); + friend class EffectChain; + +public: virtual std::string effect_type_id() const { return "GammaExpansionEffect"; } std::string output_fragment_shader(); -- 2.39.5