Whole new world

Updated to use new libdeflate integration that I implemented upstream in https://github.com/shssoichiro/oxipng/pull/203.
This commit is contained in:
Ingvar Stepanyan
2020-04-02 17:07:06 +01:00
parent 629d64326d
commit 92249ac711
10 changed files with 329 additions and 162 deletions

View File

@@ -1,7 +1,10 @@
mod malloc_shim;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(catch)]
pub fn optimise(data: &[u8], level: u8) -> Vec<u8> {
let options = oxipng::Options::from_preset(level);
let mut options = oxipng::Options::from_preset(level);
options.deflate = oxipng::Deflaters::Libdeflater;
oxipng::optimize_from_memory(data, &options).unwrap_throw()
}