mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Allocate correct bytecount when serializing
The size of buffer calculated for serializing data was not accounting for hidden frame data. This would cause the bottoms of images to sometimes be truncated when using undo.
This commit is contained in:
parent
cb41a72b5b
commit
1aadd4ab96
@ -42,7 +42,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ns.ArrayBufferSerializer = {
|
ns.ArrayBufferSerializer = {
|
||||||
calculateRequiredBytes : function(piskel, framesData) {
|
calculateRequiredBytes : function(piskel, framesData, serializedHiddenFrames) {
|
||||||
var width = piskel.getWidth();
|
var width = piskel.getWidth();
|
||||||
var height = piskel.getHeight();
|
var height = piskel.getHeight();
|
||||||
var descriptorNameLength = piskel.getDescriptor().name.length;
|
var descriptorNameLength = piskel.getDescriptor().name.length;
|
||||||
@ -63,6 +63,9 @@
|
|||||||
// Layers meta
|
// Layers meta
|
||||||
bytes += 1 * 2;
|
bytes += 1 * 2;
|
||||||
|
|
||||||
|
// Frames meta
|
||||||
|
bytes += 1 * 2;
|
||||||
|
|
||||||
/********/
|
/********/
|
||||||
/* DATA */
|
/* DATA */
|
||||||
/********/
|
/********/
|
||||||
@ -72,6 +75,9 @@
|
|||||||
// Descriptor description
|
// Descriptor description
|
||||||
bytes += descriptorDescriptionLength * 2;
|
bytes += descriptorDescriptionLength * 2;
|
||||||
|
|
||||||
|
// Hidden frames
|
||||||
|
bytes += serializedHiddenFrames.length * 2;
|
||||||
|
|
||||||
// Layers
|
// Layers
|
||||||
for (var i = 0, layers = piskel.getLayers(); i < layers.length; i++) {
|
for (var i = 0, layers = piskel.getLayers(); i < layers.length; i++) {
|
||||||
bytes += 5 * 2;
|
bytes += 5 * 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user