Repository: flutter
Issue: Different results on html/canvaskit when rendering image created by decodeImageFromPixels() function
Labels: engine,platform-web,a: images,e: web_html,has reproducible steps,P3,team-web,triaged-web,found in release: 3.19,found in release: 3.22

### Steps to reproduce

1. Create a project by using the sample code below.
2. Click on the "+" button to generate a semi-transparent 1px * 1px image.

### Expected results

Same results on canvaskit/html renderer.

### Actual results

The generated images are different on canvaskit/html renderer.

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'dart:async';
import 'dart:typed_data';
import 'dart:ui' as ui;

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  ui.Image? image;

  void _addImage() async {
    image = await createImage();
    setState(() => {});
  }

  Future<ui.Image> createImage() async {
    final bytes = Uint8List.fromList([127, 0, 0, 127]);
    final completer = Completer<ui.Image>();
    ui.decodeImageFromPixels(bytes, 1, 1, ui.PixelFormat.rgba8888, completer.complete);
    return completer.future;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
          child: Transform(
              transform: Matrix4.identity().scaled(100.0, 100.0), child: CustomPaint(painter: MyPainter(state: this)))),
      floatingActionButton: FloatingActionButton(
        onPressed: _addImage,
        child: const Icon(Icons.add),
      ),
    );
  }
}

class MyPainter extends CustomPainter {
  final _MyHomePageState _state;

  MyPainter({required state}) : _state = state;

  @override
  void paint(ui.Canvas canvas, ui.Size size) {
    if (_state.image != null) {
      canvas.drawImage(_state.image!, Offset.zero, Paint());
    }
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return true;
  }
}
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

Canvaskit:
![image](https://github.com/flutter/flutter/assets/147166040/491c98cc-ac07-46dc-8245-6a0f9f6534e7)

HTML:
![image](https://github.com/flutter/flutter/assets/147166040/0475bafb-1538-46d5-8809-ad9fd12d0058)


</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[√] Flutter (Channel stable, 3.16.5, on Microsoft Windows [Version 10.0.22631.3296], locale en-US)
    • Flutter version 3.16.5 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 78666c8dc5 (5 months ago), 2023-12-19 16:14:14 -0800
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4

[√] Windows Version (Installed version of Windows is version 10 or higher)

[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.8.6)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional
    • Visual Studio Professional 2022 version 17.8.34525.116
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:   
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] VS Code (version 1.89.0)
    • VS Code at C:\Users\lpeter\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.88.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.3296]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 124.0.6367.92
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 124.0.2478.80

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 3 categories.
```

</details>