mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-12 04:49:32 +08:00
(GraFormat): fixed stride calculation.
This commit is contained in:
parent
66dc447ddb
commit
ecce8f59ef
@ -26,9 +26,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using GameRes.Compression;
|
using GameRes.Compression;
|
||||||
|
|
||||||
namespace GameRes.Formats.MnoViolet
|
namespace GameRes.Formats.MnoViolet
|
||||||
@ -78,15 +76,12 @@ namespace GameRes.Formats.MnoViolet
|
|||||||
|
|
||||||
public override ImageData Read (Stream stream, ImageMetaData info)
|
public override ImageData Read (Stream stream, ImageMetaData info)
|
||||||
{
|
{
|
||||||
var meta = info as GraMetaData;
|
var meta = (GraMetaData)info;
|
||||||
if (null == meta)
|
|
||||||
throw new ArgumentException ("GraFormat.Read should be supplied with GraMetaData", "info");
|
|
||||||
|
|
||||||
stream.Position = 0x14;
|
stream.Position = 0x14;
|
||||||
using (var reader = new LzssReader (stream, meta.PackedSize, meta.UnpackedSize))
|
using (var reader = new LzssReader (stream, meta.PackedSize, meta.UnpackedSize))
|
||||||
{
|
{
|
||||||
reader.Unpack();
|
reader.Unpack();
|
||||||
int stride = (int)info.Width*info.BPP/8;
|
int stride = ((int)info.Width*info.BPP/8 + 3) & ~3;
|
||||||
PixelFormat format;
|
PixelFormat format;
|
||||||
if (24 == info.BPP)
|
if (24 == info.BPP)
|
||||||
format = PixelFormats.Bgr24;
|
format = PixelFormats.Bgr24;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user