From 67120cb1cdbc6dcd59b4854124855e2f10cead73 Mon Sep 17 00:00:00 2001 From: morkt Date: Wed, 3 Aug 2016 10:18:49 +0400 Subject: [PATCH] (AlpBitmap): take bitmap stride into account. --- ArcFormats/NekoSDK/ImageALP.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ArcFormats/NekoSDK/ImageALP.cs b/ArcFormats/NekoSDK/ImageALP.cs index ce323688..3c2af24a 100644 --- a/ArcFormats/NekoSDK/ImageALP.cs +++ b/ArcFormats/NekoSDK/ImageALP.cs @@ -50,6 +50,7 @@ namespace GameRes.Formats.NekoSDK } file.Position = info.HeaderLength; int dst_stride = (int)info.Width * 4; + int gap = -((int)info.Width * info.BPP / 8) & 3; var pixels = new byte[(int)info.Height * dst_stride]; int src_pixel_size = info.BPP / 8; int dst = (int)(info.Height-1) * dst_stride; @@ -61,6 +62,8 @@ namespace GameRes.Formats.NekoSDK file.Read (pixels, dst+x, src_pixel_size); pixels[dst+x+3] = alpha[a_src++]; } + if (gap != 0) + file.Seek (gap, SeekOrigin.Current); dst -= dst_stride; } return ImageData.Create (info, PixelFormats.Bgra32, null, pixels, dst_stride);