private static unsafe void CallCompressImage(byte[] rgba, int width, int height, byte[] blocks, int flags) { fixed(byte *pRGBA = rgba) { fixed(byte *pBlocks = blocks) { OS curr_os = DetectOS(); if (curr_os == OS.Windows) { if (Is64Bit()) { SquishInterface_64.CompressImage(pRGBA, width, height, pBlocks, flags); } else { SquishInterface_32.CompressImage(pRGBA, width, height, pBlocks, flags); } } else if (curr_os == OS.Linux) { if (Is64Bit()) { SquishInterface_x86_64.CompressImage(pRGBA, width, height, pBlocks, flags); } } } } }
private static unsafe int SquishGetStorageRequirements(int width, int height, SquishFlags flags) { if (Is64Bit()) { return(SquishInterface_64.SquishGetStorageRequirements(width, height, (int)flags)); } else { return(SquishInterface_32.SquishGetStorageRequirements(width, height, (int)flags)); } }
public static void Initialize() { if (Is64Bit()) { SquishInterface_64.SquishInitialize(); } else { SquishInterface_32.SquishInitialize(); } }
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 SquishDecompress(byte[] rgba, byte[] block, SquishFlags flags) { fixed(byte *pRGBA = rgba) fixed(byte *pBlock = block) { if (Is64Bit()) { SquishInterface_64.SquishDecompress(pRGBA, pBlock, (int)flags); } else { SquishInterface_32.SquishDecompress(pRGBA, pBlock, (int)flags); } } }
public static void Initialize() { if (Processor.Architecture == ProcessorArchitecture.X64) { SquishInterface_64.SquishInitialize(); } else if (Processor.IsFeaturePresent(ProcessorFeature.SSE2)) { SquishInterface_32_SSE2.SquishInitialize(); } else { SquishInterface_32.SquishInitialize(); } }
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 SquishCompress(byte[] rgba, byte[] block, SquishFlags flags, float[] metric) { fixed(byte *_rgba = rgba) fixed(byte *_block = block) fixed(float *_metric = metric) { if (Is64Bit()) { SquishInterface_64.SquishCompress(_rgba, _block, (int)flags, _metric); } else { SquishInterface_32.SquishCompress(_rgba, _block, (int)flags, _metric); } } }
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); }