using System.Collections.Generic; using Unity.Collections; using UnityEngine; namespace UnityEditor.U2D.Aseprite { internal static class ImportLayers { public static void Import(List layers, out List> cellBuffers, out List cellWidth, out List cellHeight) { cellBuffers = new List>(); cellWidth = new List(); cellHeight = new List(); for (var i = 0; i < layers.Count; ++i) { var cells = layers[i].cells; for (var m = 0; m < cells.Count; ++m) { var width = cells[m].cellRect.width; var height = cells[m].cellRect.height; if (width == 0 || height == 0) continue; cellBuffers.Add(cells[m].image); cellWidth.Add(width); cellHeight.Add(height); } } for (var i = 0; i < cellBuffers.Count; ++i) { var buffer = cellBuffers[i]; TextureTasks.FlipTextureY(ref buffer, cellWidth[i], cellHeight[i]); cellBuffers[i] = buffer; } } } }