Fixed BPP in Multimedia PNG data format and some errors in MemoryAccessor

This commit is contained in:
Michael Becker 2014-04-06 00:14:55 -04:00
parent 8c7d685b3d
commit 77bff918cc
3 changed files with 5 additions and 4 deletions

View File

@ -56,7 +56,7 @@ namespace UniversalEditor.Accessors
break;
}
}
if (start >= 0 && start < _data.Length)
if (start >= 0 && start <= _data.Length)
{
ptr = start;
}
@ -75,7 +75,8 @@ namespace UniversalEditor.Accessors
internal override int ReadInternal(byte[] buffer, int start, int count)
{
System.Array.Copy(_data, 0, buffer, start, count);
System.Array.Copy(_data, Position, buffer, start, count);
Position += count;
return count;
}
internal override int WriteInternal(byte[] buffer, int start, int count)

View File

@ -5,7 +5,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A92D520B-FFA3-4464-8CF6-474D18959E03}</ProjectGuid>
<ProjectGuid>{2D4737E6-6D95-408A-90DB-8DFF38147E85}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UniversalEditor</RootNamespace>

View File

@ -59,7 +59,7 @@ namespace UniversalEditor.DataFormats.Multimedia.Picture.PortableNetworkGraphics
compressionModule.ImageWidth = pic.Width;
compressionModule.ImageHeight = pic.Height;
compressionModule.Method = compressionMethod;
compressionModule.BytesPerPixel = ((bitDepth / 8) * 3);
compressionModule.BytesPerPixel = (int)(((double)bitDepth / 8) * 3);
byte[] uncompressed = compressionModule.Decompress(uncompressedFilteredImageData);