fix(liquid_rescale_task.rs): change input_image parameter type from Vec<u8> to &[u8] to avoid unnecessary cloning and improve performance
This commit is contained in:
parent
9c3b4b9608
commit
a8d7a39b2f
@ -26,7 +26,7 @@ impl LiquidRescaleTask {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn liquid_rescale(input_image: Vec<u8>, width: usize, height: usize) -> Result<Buffer> {
|
||||
pub fn liquid_rescale(input_image: &[u8], width: usize, height: usize) -> Result<Buffer> {
|
||||
START.call_once(|| {
|
||||
magick_wand_genesis();
|
||||
});
|
||||
@ -52,11 +52,7 @@ impl Task for LiquidRescaleTask {
|
||||
type JsValue = Buffer;
|
||||
|
||||
fn compute(&mut self) -> Result<Self::Output> {
|
||||
Self::liquid_rescale(
|
||||
self.input_image.clone().into(),
|
||||
self.output_width,
|
||||
self.output_height,
|
||||
)
|
||||
Self::liquid_rescale(&self.input_image, self.output_width, self.output_height)
|
||||
}
|
||||
|
||||
fn resolve(&mut self, _env: napi::Env, output: Self::Output) -> Result<Self::JsValue> {
|
||||
|
Loading…
Reference in New Issue
Block a user