X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Flayer_composite.cpp;h=2cd6a170fb54872bbeab35b831d4334034926d04;hb=2dc2a206a800705cce91751de1ec3127c2ac2397;hp=24f640d96f4ce15b91305e13eeb3c3d9900a032f;hpb=c74ce4738eff208de3bef4b63929b6975a896e93;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/layer_composite.cpp b/synfig-core/trunk/src/synfig/layer_composite.cpp index 24f640d..2cd6a17 100644 --- a/synfig-core/trunk/src/synfig/layer_composite.cpp +++ b/synfig-core/trunk/src/synfig/layer_composite.cpp @@ -154,7 +154,32 @@ Layer_Composite::set_param(const String & param, const ValueBase &value) amount_=value.get(amount_); else if(param=="blend_method" && value.same_type_as(int())) - blend_method_=static_cast(value.get(int())); + { + blend_method_ = static_cast(value.get(int())); + + if (blend_method_ < 0 || blend_method_ >= Color::BLEND_END) + { + warning("illegal value (%d) for blend_method - using Composite instead", blend_method_); + blend_method_ = Color::BLEND_COMPOSITE; + return false; + } + + if (blend_method_ == Color::BLEND_STRAIGHT && !reads_context()) + { + Canvas::Handle canvas(get_canvas()); + if (canvas) + { + String version(canvas->get_version()); + + if (version == "0.1" || version == "0.2") + if (get_name() == "PasteCanvas") + warning("loaded a version %s canvas with a 'Straight' blended PasteCanvas (%s) - check it renders OK", + version.c_str(), get_non_empty_description().c_str()); + else + blend_method_ = Color::BLEND_COMPOSITE; + } + } + } else return Layer::set_param(param,value); return true;