mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-12 08:47:31 +00:00
Minor cleanup
This commit is contained in:
@@ -10,7 +10,7 @@ use resize::Type;
|
|||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
mod srgb;
|
mod srgb;
|
||||||
use srgb::{linear_to_srgb, srgb_to_linear, Clamp};
|
use srgb::{linear_to_srgb, Clamp};
|
||||||
|
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
|
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
|
||||||
@@ -85,7 +85,7 @@ pub fn resize(
|
|||||||
|
|
||||||
let mut output_image: Vec<u8> = vec_with_len(num_output_pixels * 4, 0);
|
let mut output_image: Vec<u8> = vec_with_len(num_output_pixels * 4, 0);
|
||||||
|
|
||||||
// If both options are false, there is no preprocessing on the pixel valus
|
// If both options are false, there is no preprocessing on the pixel values
|
||||||
// and we can skip the loop.
|
// and we can skip the loop.
|
||||||
if !premultiply && !color_space_conversion {
|
if !premultiply && !color_space_conversion {
|
||||||
let mut resizer = resize::new(
|
let mut resizer = resize::new(
|
||||||
@@ -100,8 +100,8 @@ pub fn resize(
|
|||||||
return output_image;
|
return output_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, we convert to f32 images so we don’t introduce
|
// Otherwise, we convert to f32 images to keep the
|
||||||
// banding through the conversions.
|
// conversions as lossless and high-fidelity as possible.
|
||||||
let (to_linear, to_srgb) = srgb_converter_funcs(color_space_conversion);
|
let (to_linear, to_srgb) = srgb_converter_funcs(color_space_conversion);
|
||||||
let (premultiplier, demultiplier) = alpha_multiplier_funcs(premultiply);
|
let (premultiplier, demultiplier) = alpha_multiplier_funcs(premultiply);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user