private static unsafe void SquishDecompressImage(byte[] rgba, int width, int height, byte[] blocks, SquishFlags flags) { fixed(byte *pRGBA = rgba) fixed(byte *pBlocks = blocks) { if (Is64Bit()) { SquishInterface_64.SquishDecompressImage(pRGBA, width, height, pBlocks, (int)flags); } else { SquishInterface_32.SquishDecompressImage(pRGBA, width, height, pBlocks, (int)flags); } } }
private static unsafe void CallDecompressImage(byte[] rgba, int width, int height, byte[] blocks, int flags, ProgressFn progressFn) { fixed(byte *pRGBA = rgba) { fixed(byte *pBlocks = blocks) { if (Processor.Architecture == ProcessorArchitecture.X64) { SquishInterface_64.SquishDecompressImage(pRGBA, width, height, pBlocks, flags, progressFn); } else if (Processor.IsFeaturePresent(ProcessorFeature.SSE2)) { SquishInterface_32_SSE2.SquishDecompressImage(pRGBA, width, height, pBlocks, flags, progressFn); } else { SquishInterface_32.SquishDecompressImage(pRGBA, width, height, pBlocks, flags, progressFn); } } } GC.KeepAlive(progressFn); }