From ecce8f59ef89520349b35cf7f773fab99aabd3b2 Mon Sep 17 00:00:00 2001 From: morkt Date: Sun, 6 Mar 2016 15:13:06 +0400 Subject: [PATCH] (GraFormat): fixed stride calculation. --- ArcFormats/MnoViolet/ImageGRA.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ArcFormats/MnoViolet/ImageGRA.cs b/ArcFormats/MnoViolet/ImageGRA.cs index cf4486f3..6e4e2d08 100644 --- a/ArcFormats/MnoViolet/ImageGRA.cs +++ b/ArcFormats/MnoViolet/ImageGRA.cs @@ -26,9 +26,7 @@ using System; using System.ComponentModel.Composition; using System.IO; -using System.Windows; using System.Windows.Media; -using System.Windows.Media.Imaging; using GameRes.Compression; namespace GameRes.Formats.MnoViolet @@ -78,15 +76,12 @@ namespace GameRes.Formats.MnoViolet public override ImageData Read (Stream stream, ImageMetaData info) { - var meta = info as GraMetaData; - if (null == meta) - throw new ArgumentException ("GraFormat.Read should be supplied with GraMetaData", "info"); - + var meta = (GraMetaData)info; stream.Position = 0x14; using (var reader = new LzssReader (stream, meta.PackedSize, meta.UnpackedSize)) { reader.Unpack(); - int stride = (int)info.Width*info.BPP/8; + int stride = ((int)info.Width*info.BPP/8 + 3) & ~3; PixelFormat format; if (24 == info.BPP) format = PixelFormats.Bgr24;