From 56e11169710ec5cbb21e7c227d03e8a8767cbd8c Mon Sep 17 00:00:00 2001 From: morkt Date: Tue, 2 Jun 2015 19:50:11 +0400 Subject: [PATCH] (DgcFormat.Reader): use CopyOverlapped instead of BlockCopy. --- ArcFormats/ImageDGC.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ArcFormats/ImageDGC.cs b/ArcFormats/ImageDGC.cs index b4c38b1d..d9f4e48b 100644 --- a/ArcFormats/ImageDGC.cs +++ b/ArcFormats/ImageDGC.cs @@ -278,7 +278,9 @@ namespace GameRes.Formats.Dac int count = (ctl & 0x3F) + 2; int offset = ctl >> 6; offset *= m_pixel_size; - Buffer.BlockCopy (m_output, dst+offset, m_output, dst, count*m_pixel_size); + count *= m_pixel_size; + Binary.CopyOverlapped (m_output, dst+offset, dst, count); + dst += count; } else { @@ -355,8 +357,7 @@ namespace GameRes.Formats.Dac --length; if (0 == (ctl & 0x80)) { - int count = ctl + 2; - while (0 != count--) + for (int count = ctl + 2; 0 != count; --count) { int src = 3 * m_input.ReadByte(); --length; @@ -373,8 +374,9 @@ namespace GameRes.Formats.Dac int count = (offset & 0x3F) + 4; offset >>= 6; offset *= m_pixel_size; - Buffer.BlockCopy (m_output, dst+offset, m_output, dst, count*m_pixel_size); - dst += count*m_pixel_size; + count *= m_pixel_size; + Binary.CopyOverlapped (m_output, dst+offset, dst, count); + dst += count; } } }