Save/restore opacity & blend mode correctly from recovery data

This commit is contained in:
David Capello 2017-04-13 16:09:29 -03:00
parent d1508ce119
commit fe5d3236a3
2 changed files with 9 additions and 0 deletions

View File

@ -302,6 +302,7 @@ private:
return spr.release(); return spr.release();
} }
// TODO could we use doc::read_layer() here?
Layer* readLayer(std::ifstream& s) { Layer* readLayer(std::ifstream& s) {
LayerFlags flags = (LayerFlags)read32(s); LayerFlags flags = (LayerFlags)read32(s);
ObjectType type = (ObjectType)read16(s); ObjectType type = (ObjectType)read16(s);
@ -315,6 +316,10 @@ private:
lay->setName(name); lay->setName(name);
lay->setFlags(flags); lay->setFlags(flags);
// Blend mode & opacity
lay->setBlendMode((BlendMode)read16(s));
lay->setOpacity(read8(s));
// Cels // Cels
int ncels = read32(s); int ncels = read32(s);
for (int i=0; i<ncels; ++i) { for (int i=0; i<ncels; ++i) {

View File

@ -190,6 +190,10 @@ private:
CelConstIterator it, begin = static_cast<const LayerImage*>(lay)->getCelBegin(); CelConstIterator it, begin = static_cast<const LayerImage*>(lay)->getCelBegin();
CelConstIterator end = static_cast<const LayerImage*>(lay)->getCelEnd(); CelConstIterator end = static_cast<const LayerImage*>(lay)->getCelEnd();
// Blend mode & opacity
write16(s, (int)static_cast<const LayerImage*>(lay)->blendMode());
write8(s, static_cast<const LayerImage*>(lay)->opacity());
// Cels // Cels
write32(s, static_cast<const LayerImage*>(lay)->getCelsCount()); write32(s, static_cast<const LayerImage*>(lay)->getCelsCount());
for (it=begin; it != end; ++it) { for (it=begin; it != end; ++it) {