Skip to content

Commit

Permalink
Merge pull request #314 from Kopernicus/ddsLoader-1
Browse files Browse the repository at this point in the history
reduce RAM usage
StollD authored Oct 12, 2018
2 parents cc111be + afa3044 commit e751809
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Kopernicus.OnDemand/OnDemandStorage.cs
Original file line number Diff line number Diff line change
@@ -447,7 +447,7 @@ public static Texture2D LoadTexture(String path, Boolean compress, Boolean uploa

if (length - 128 >= pixels)
{
byte[] data = LoadRestOfReader(binaryReader);
byte[] data = binaryReader.ReadBytes(pixels);

Color[] palette = new Color[colors];
Color[] image = new Color[width * height];
@@ -458,7 +458,7 @@ public static Texture2D LoadTexture(String path, Boolean compress, Boolean uploa
data[i + 3]);
}

for (int i = 4 * colors; i < pixels; i++)
for (int i = 4 * colors; i < data.Length; i++)
{
image[(i - 4 * colors) * 8 / bpp] = palette[data[i] * colors / 256];
if (bpp == 4)

0 comments on commit e751809

Please sign in to comment.