mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-11 16:26:20 +00:00
Update src/client/lazy-app/util/index.ts
Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
This commit is contained in:
@@ -249,15 +249,13 @@ export async function builtinDecode(
|
||||
return await WebCodecs.decode(blob, mimeType);
|
||||
} catch (e) {}
|
||||
}
|
||||
if (signal.aborted) return Promise.reject('Aborted');
|
||||
|
||||
assertSignal(signal);
|
||||
|
||||
// Prefer createImageBitmap as it's the off-thread option for Firefox.
|
||||
const drawable =
|
||||
'createImageBitmap' in self
|
||||
? await createImageBitmap(blob)
|
||||
: await blobToImg(blob);
|
||||
|
||||
if (signal.aborted) return Promise.reject('Aborted');
|
||||
const drawable = await abortable(
|
||||
signal,
|
||||
'createImageBitmap' in self ? createImageBitmap(blob) : blobToImg(blob),
|
||||
);
|
||||
return drawableToImageData(drawable);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user