mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Adds wide gamut color support to macOS (matching iOS), upgrades the surface pixel format from 10-bit BGRA10_XR to 16-bit float RGBA16Float on both iOS and macOS when enabled, and fixes Impeller's blur filter P3 clamping on macOS. **macOS Wide Gamut Support** - Added DoesHardwareSupportWideGamut() hardware capability check (MTLGPUFamilyApple2 or MTLGPUFamilyMac2) - Wide gamut enabled when both hardware supports it and FLTEnableWideGamut plist flag is YES - Dynamic wide gamut switching when windows move between P3 and sRGB displays - Added flutter/screenshot method channel on macOS for integration testing **RGBA16Float Surface Format (iOS + macOS)** - macOS IOSurface: kCVPixelFormatType_64RGBAHalf + MTLPixelFormatRGBA16Float - iOS CAMetalLayer: MTLPixelFormatRGBA16Float - Image decoder: always uses kRGBA_F16_SkColorType for all wide gamut images (previously only transparent images used 16-bit) **Fix Blur P3 Clamping on macOS** macOS uses the compositor/embedder path, not GPUSurfaceMetalImpeller, so UpdateOffscreenLayerPixelFormat was never called. Added the call in embedder.cc after wrapping the Metal resolve texture. **Why RGBA16Float over BGRA10_XR?** BGRA10_XR has only 10 bits per channel — values outside sRGB gamut get clamped in intermediate render targets (e.g. blur filters). RGBA16Float has 16 bits per channel with full floating-point range, preventing P3 color clamping in multi-pass rendering. **Tests** - 9 new iOS FlutterView unit tests verifying RGBA16Float pixel format and extended sRGB color space - Updated macOS FlutterSurfaceManagerTest for RGBA16Float, dynamic switching, color space, and pixel format verification - Updated image decoder and Impeller display list tests for kR16G16B16A16Float - 11 macOS/iOS integration tests: image, saveLayer, codecImage, none, blur, drawnImage, container, linearGradient, radialGradient, conicalGradient, sweepGradient ### Issues https://github.com/flutter/flutter/issues/164557 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing.
This directory contains tools and resources that the Flutter team uses during the development of the framework. The tools in this directory should not be necessary for developing Flutter applications, though of course, they may be interesting if you are curious.
The tests in this directory are run in the framework_tests_misc-*
shards.