mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This improves Flutter Window's texture format logic: 1. **If the device has extension `GL_EXT_texture_format_BGRA8888`**: backing stores' texture will be created with format `GL_BGRA_EXT` instead of `GL_RGBA8`. This is what fixes https://github.com/flutter/flutter/issues/150546. 2. **Otherwise**: backing stores' texture will be created with format `GL_RGBA` and the engine will use the color type `kRGBA_8888_SkColorType` when creating the `SkSurface`. Previously the engine always used color type `kN32_SkColorType`, which could be either RGBA or BGRA depending on the machine that compiled the engine. This caused Skia validation errors as the texture's format did not match the Skia surface's color type. I tested this by editing Flutter Windows to force it down this code path. Huge kudos to @chinmaygarde for the OpenGL expertise! Fixes: https://github.com/flutter/flutter/issues/150546 > [!WARNING] > Unfortunately, we are unable to test this. > This bug appears to only affect older devices; none of our devices reproduce this issue. > We also do not have the infrastructure to do a native screenshot test on Windows. > I will get a test exemption for this change. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Windows Platform Embedder
This code is the glue between the Flutter engine and the Windows platform. It is responsible for:
- Launching the Flutter engine.
- Providing a view for the Flutter engine to render into.
- Dispatching events to the Flutter engine.
For more information on embedders, see the Flutter architectural overview.
Caution
This is a best effort attempt to document the Windows embedder. It is not guaranteed to be up to date or complete. If you find a discrepancy, please send a pull request!
See also:
- Flutter tool's Windows logic - Builds and runs Flutter Windows apps on the command line.
- Windows app template - The entrypoint for Flutter Windows app. This launches the Windows embedder.
platform-windowsGitHub issues label#hackers-desktopDiscord channel
Developing
See:
- Setting up the Engine development environment
- Compiling for Windows
- Debugging Windows builds with Visual Studio
Notable files
Some notable files include:
flutter_windows_engine.h- Connects the Windows embedder to the Flutter engine.flutter_windows_view.h- The logic for a Flutter view.flutter_window.h- Integrates a Flutter view with Windows (using a win32 child window).//shell/platform/embedder/embedder.h- The API boundary between the Windows embedder and the Flutter engine.