private static unsafe void SquishCompressImage(byte[] rgba, int width, int height, byte[] blocks, SquishFlags flags, float[] metric) { fixed(byte *_rgba = rgba) fixed(byte *_blocks = blocks) fixed(float *_metric = metric) { if (Is64Bit()) { SquishInterface_64.SquishCompressImage(_rgba, width, height, _blocks, (int)flags, _metric); } else { SquishInterface_32.SquishCompressImage(_rgba, width, height, _blocks, (int)flags, _metric); } } }
private static unsafe void CallCompressImage(byte[] rgba, int width, int height, byte[] blocks, int flags) { fixed(byte *pRGBA = rgba) { fixed(byte *pBlocks = blocks) { if (Is64Bit()) { SquishInterface_64.SquishCompressImage(pRGBA, width, height, pBlocks, flags); } else { SquishInterface_32.SquishCompressImage(pRGBA, width, height, pBlocks, flags); } } } }
private static unsafe void CallCompressImage(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.SquishCompressImage(pRGBA, width, height, pBlocks, flags, progressFn); } else if (Processor.IsFeaturePresent(ProcessorFeature.SSE2)) { SquishInterface_32_SSE2.SquishCompressImage(pRGBA, width, height, pBlocks, flags, progressFn); } else { SquishInterface_32.SquishCompressImage(pRGBA, width, height, pBlocks, flags, progressFn); } } } GC.KeepAlive(progressFn); }