forked from external-repos/squoosh
Compare commits
14 Commits
v1.3.2
...
windows-bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ace858bfe | ||
|
|
0388bde540 | ||
|
|
26fb713560 | ||
|
|
e801170496 | ||
|
|
91e7c9c5ad | ||
|
|
ca5162ed32 | ||
|
|
0bf87d0c87 | ||
|
|
ce91eb5bae | ||
|
|
8d68056bca | ||
|
|
d0de8e444a | ||
|
|
dfef1f21cc | ||
|
|
2440ac4e87 | ||
|
|
e90db78697 | ||
|
|
5ae15d429c |
2
codecs/rotate/.gitignore
vendored
Normal file
2
codecs/rotate/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
target
|
||||||
|
Cargo.lock
|
||||||
14
codecs/rotate/Cargo.toml
Normal file
14
codecs/rotate/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[package]
|
||||||
|
name = "rotate"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Surma <surma@google.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "rotate"
|
||||||
|
path = "rotate.rs"
|
||||||
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = true
|
||||||
|
opt-level = "s"
|
||||||
@@ -7,12 +7,11 @@ echo "Compiling wasm"
|
|||||||
echo "============================================="
|
echo "============================================="
|
||||||
(
|
(
|
||||||
rustup run nightly \
|
rustup run nightly \
|
||||||
rustc \
|
cargo build \
|
||||||
--target=wasm32-unknown-unknown \
|
--target wasm32-unknown-unknown \
|
||||||
-C opt-level=3 \
|
--release
|
||||||
-o rotate.wasm \
|
cp target/wasm32-unknown-unknown/release/rotate.wasm .
|
||||||
rotate.rs
|
wasm-strip rotate.wasm
|
||||||
wasm-strip rotate.wasm
|
|
||||||
)
|
)
|
||||||
echo "============================================="
|
echo "============================================="
|
||||||
echo "Compiling wasm done"
|
echo "Compiling wasm done"
|
||||||
|
|||||||
@@ -1,8 +1,22 @@
|
|||||||
#![no_std]
|
use std::slice::from_raw_parts_mut;
|
||||||
#![no_main]
|
|
||||||
|
|
||||||
use core::panic::PanicInfo;
|
// This function is taken from
|
||||||
use core::slice::from_raw_parts_mut;
|
// https://rustwasm.github.io/book/reference/code-size.html
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
#[inline]
|
||||||
|
pub fn unwrap_abort<T>(o: Option<T>) -> T {
|
||||||
|
use std::process;
|
||||||
|
match o {
|
||||||
|
Some(t) => t,
|
||||||
|
None => process::abort(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normal panic-y behavior for debug builds
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
unsafe fn unchecked_unwrap<T>(o: Option<T>) -> T {
|
||||||
|
o.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
fn rotate(input_width: isize, input_height: isize, rotate: isize) {
|
fn rotate(input_width: isize, input_height: isize, rotate: isize) {
|
||||||
@@ -69,13 +83,8 @@ fn rotate(input_width: isize, input_height: isize, rotate: isize) {
|
|||||||
for d2 in 0..d2_limit {
|
for d2 in 0..d2_limit {
|
||||||
for d1 in 0..d1_limit {
|
for d1 in 0..d1_limit {
|
||||||
let in_idx = (d1_start + d1 * d1_advance) * d1_multiplier + (d2_start + d2 * d2_advance) * d2_multiplier;
|
let in_idx = (d1_start + d1 * d1_advance) * d1_multiplier + (d2_start + d2 * d2_advance) * d2_multiplier;
|
||||||
out_b[i as usize] = in_b[in_idx as usize];
|
*unwrap_abort(out_b.get_mut(i as usize)) = *unwrap_abort(in_b.get(in_idx as usize));
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[panic_handler]
|
|
||||||
fn panic(_info: &PanicInfo) -> ! {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|||||||
Binary file not shown.
449
package-lock.json
generated
449
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "squoosh",
|
"name": "squoosh",
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"license": "apache-2.0",
|
"license": "apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack-dev-server --host 0.0.0.0 --hot",
|
"start": "webpack-dev-server --host 0.0.0.0 --hot",
|
||||||
@@ -16,13 +16,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "10.12.23",
|
"@types/node": "10.12.26",
|
||||||
"@types/pretty-bytes": "5.1.0",
|
"@types/pretty-bytes": "5.1.0",
|
||||||
"@types/webassembly-js-api": "0.0.2",
|
"@types/webassembly-js-api": "0.0.2",
|
||||||
"@webcomponents/custom-elements": "1.2.1",
|
"@webcomponents/custom-elements": "1.2.1",
|
||||||
"@webpack-cli/serve": "0.1.3",
|
"@webpack-cli/serve": "0.1.3",
|
||||||
"assets-webpack-plugin": "3.9.7",
|
"assets-webpack-plugin": "3.9.7",
|
||||||
"chokidar": "2.1.0",
|
"chokidar": "2.1.1",
|
||||||
"chalk": "2.4.2",
|
"chalk": "2.4.2",
|
||||||
"classnames": "2.2.6",
|
"classnames": "2.2.6",
|
||||||
"clean-webpack-plugin": "1.0.1",
|
"clean-webpack-plugin": "1.0.1",
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
"typescript": "3.2.4",
|
"typescript": "3.2.4",
|
||||||
"url-loader": "1.1.2",
|
"url-loader": "1.1.2",
|
||||||
"webpack": "4.28.0",
|
"webpack": "4.28.0",
|
||||||
"webpack-bundle-analyzer": "3.0.3",
|
"webpack-bundle-analyzer": "3.0.4",
|
||||||
"webpack-cli": "3.2.3",
|
"webpack-cli": "3.2.3",
|
||||||
"webpack-dev-server": "3.1.14",
|
"webpack-dev-server": "3.1.14",
|
||||||
"worker-plugin": "3.0.0"
|
"worker-plugin": "3.0.0"
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ const CrittersPlugin = require('critters-webpack-plugin');
|
|||||||
const AssetTemplatePlugin = require('./config/asset-template-plugin');
|
const AssetTemplatePlugin = require('./config/asset-template-plugin');
|
||||||
const addCssTypes = require('./config/add-css-types');
|
const addCssTypes = require('./config/add-css-types');
|
||||||
|
|
||||||
|
const regexpPathSep = path.sep === '\\' ? '\\\\' : '/';
|
||||||
|
|
||||||
function readJson (filename) {
|
function readJson (filename) {
|
||||||
return JSON.parse(fs.readFileSync(filename));
|
return JSON.parse(fs.readFileSync(filename));
|
||||||
}
|
}
|
||||||
@@ -38,7 +40,7 @@ module.exports = async function (_, env) {
|
|||||||
return {
|
return {
|
||||||
mode: isProd ? 'production' : 'development',
|
mode: isProd ? 'production' : 'development',
|
||||||
entry: {
|
entry: {
|
||||||
'first-interaction': './src/index'
|
'first-interaction': path.join('.', 'src', 'index'),
|
||||||
},
|
},
|
||||||
devtool: isProd ? 'source-map' : 'inline-source-map',
|
devtool: isProd ? 'source-map' : 'inline-source-map',
|
||||||
stats: 'minimal',
|
stats: 'minimal',
|
||||||
@@ -52,13 +54,13 @@ module.exports = async function (_, env) {
|
|||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.ts', '.tsx', '.mjs', '.js', '.scss', '.css'],
|
extensions: ['.ts', '.tsx', '.mjs', '.js', '.scss', '.css'],
|
||||||
alias: {
|
alias: {
|
||||||
style: path.join(__dirname, 'src/style')
|
style: path.join(__dirname, 'src', 'style')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolveLoader: {
|
resolveLoader: {
|
||||||
alias: {
|
alias: {
|
||||||
// async-component-loader returns a wrapper component that waits for the import to load before rendering:
|
// async-component-loader returns a wrapper component that waits for the import to load before rendering:
|
||||||
async: path.join(__dirname, 'config/async-component-loader')
|
async: path.join(__dirname, 'config', 'async-component-loader')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
@@ -147,11 +149,11 @@ module.exports = async function (_, env) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
// All the codec files define a global with the same name as their file name. `exports-loader` attaches those to `module.exports`.
|
// All the codec files define a global with the same name as their file name. `exports-loader` attaches those to `module.exports`.
|
||||||
test: /\/codecs\/.*\.js$/,
|
test: new RegExp(`${regexpPathSep}codecs${regexpPathSep}.*\.js`),
|
||||||
loader: 'exports-loader'
|
loader: 'exports-loader'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\/codecs\/.*\.wasm$/,
|
test: new RegExp(`${regexpPathSep}codecs${regexpPathSep}.*\.wasm`),
|
||||||
// This is needed to make webpack NOT process wasm files.
|
// This is needed to make webpack NOT process wasm files.
|
||||||
// See https://github.com/webpack/webpack/issues/6725
|
// See https://github.com/webpack/webpack/issues/6725
|
||||||
type: 'javascript/auto',
|
type: 'javascript/auto',
|
||||||
@@ -172,7 +174,7 @@ module.exports = async function (_, env) {
|
|||||||
plugins: [
|
plugins: [
|
||||||
new webpack.IgnorePlugin(
|
new webpack.IgnorePlugin(
|
||||||
/(fs|crypto|path)/,
|
/(fs|crypto|path)/,
|
||||||
new RegExp(`${path.sep}codecs${path.sep}`)
|
new RegExp(`${regexpPathSep}codecs${regexpPathSep}`)
|
||||||
),
|
),
|
||||||
|
|
||||||
// Pretty progressbar showing build progress:
|
// Pretty progressbar showing build progress:
|
||||||
|
|||||||
Reference in New Issue
Block a user