opt: early unlock frame

This commit is contained in:
Kingtous
2023-02-15 16:44:40 +08:00
parent e7ed73a124
commit 2047fd822b
2 changed files with 8 additions and 4 deletions

View File

@ -11,6 +11,7 @@ Future<ui.Image> decodeImageFromPixels(
int? rowBytes,
int? targetWidth,
int? targetHeight,
VoidCallback? onPixelsCopied,
bool allowUpscaling = true,
}) async {
if (targetWidth != null) {
@ -22,6 +23,7 @@ Future<ui.Image> decodeImageFromPixels(
final ui.ImmutableBuffer buffer =
await ui.ImmutableBuffer.fromUint8List(pixels);
onPixelsCopied?.call();
final ui.ImageDescriptor descriptor = ui.ImageDescriptor.raw(
buffer,
width: width,