void LoadRLE(int[] indices, BinaryReader reader, int width, int height, int codeSize, int[] aux = null, int auxOffset = 0) { RLELoader loader = new RLELoader(reader, codeSize, aux, auxOffset); bool state = true; for (int offset = 0, end = width * height; offset < end; state = !state) { int count = loader.ReadCount(); if (state) { if (count == 2) { int repeatCount = loader.ReadCount(); for (int repeatIndex = 0; repeatIndex < repeatCount; repeatIndex++) { int runCount = loader.ReadCount(); int runValue = loader.ReadAux(); for (int runIndex = 0; runIndex < runCount; runIndex++) { indices[offset++] = runValue; } } } else if (count > 1) { int value = loader.ReadAux(); for (int index = 0; index < count; index++) { indices[offset++] = value; } } } else { for (int index = 0; index < count; index++) { indices[offset++] = loader.ReadAux(); } } } }
void LoadRLE(int[] indices, BinaryReader reader, int width, int height, int codeSize, int[] aux = null, int auxOffset = 0) { RLELoader loader = new RLELoader(reader, codeSize, aux, auxOffset); bool state = true; for (int offset = 0, end = width * height; offset < end; state = !state) { int count = loader.ReadCount(); if (state) { if (count == 2) { int repeatCount = loader.ReadCount(); for (int repeatIndex = 0; repeatIndex < repeatCount; repeatIndex++) { int runCount = loader.ReadCount(); int runValue = loader.ReadAux(); for (int runIndex = 0; runIndex < runCount; runIndex++) indices[offset++] = runValue; } } else if (count > 1) { int value = loader.ReadAux(); for (int index = 0; index < count; index++) indices[offset++] = value; } } else { for (int index = 0; index < count; index++) indices[offset++] = loader.ReadAux(); } } }