From dde2c3dadfdf428cfc31fdfa782396aebfbd2a7f Mon Sep 17 00:00:00 2001 From: Zer01HD Date: Wed, 5 Dec 2018 15:18:22 -0600 Subject: [PATCH] cleaned up pipeline code for atlas --- .../TextureAtlas/TextureAtlasImporter.cs | 1 + .../TextureAtlas/TextureAtlasProcessor.cs | 19 +++++++++---------- RecrownedAthenaeum/DataTypes/NinePatch.cs | 2 -- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasImporter.cs b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasImporter.cs index c687e1c..5c68361 100644 --- a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasImporter.cs +++ b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasImporter.cs @@ -21,6 +21,7 @@ namespace RecrownedAthenaeum.Pipeline.TextureAtlas { atlas = JsonConvert.DeserializeObject(stream.ReadToEnd()); } + context.AddDependency(atlas.textureName); return atlas; } } diff --git a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasProcessor.cs b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasProcessor.cs index bf18fda..2f03dd6 100644 --- a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasProcessor.cs +++ b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasProcessor.cs @@ -20,16 +20,15 @@ namespace RecrownedAthenaeum.Pipeline.TextureAtlas string serialized = JsonConvert.SerializeObject(input); byte[] bytes = Encoding.UTF8.GetBytes(serialized); - MemoryStream outStream = new MemoryStream(); - GZipStream gZStream = new GZipStream(outStream, CompressionLevel.Optimal); - - gZStream.Write(bytes, 0, bytes.Length); - - byte[] compressed = outStream.ToArray(); - - gZStream.Dispose(); - outStream.Dispose(); - return compressed; + using (MemoryStream outStream = new MemoryStream()) + { + using (GZipStream gZipStream = new GZipStream(outStream, CompressionLevel.Optimal)) + { + gZipStream.Write(bytes, 0, bytes.Length); + byte[] compressed = outStream.ToArray(); + return compressed; + } + } } } } diff --git a/RecrownedAthenaeum/DataTypes/NinePatch.cs b/RecrownedAthenaeum/DataTypes/NinePatch.cs index c5116b7..57a1aab 100644 --- a/RecrownedAthenaeum/DataTypes/NinePatch.cs +++ b/RecrownedAthenaeum/DataTypes/NinePatch.cs @@ -41,8 +41,6 @@ namespace RecrownedAthenaeum.DataTypes public void Draw(SpriteBatch batch, Rectangle destination) { - - Rectangle sourceRectangle; Rectangle drawnRectangle;