Repository navigation
Commit 1d790af
authored
Support wide gamut colors in gradient_generator's CreateGradientTexture (flutter#191980)
This is a prerequisite to re-implementing
flutter#190874. This addresses the
unsupported wide gamut issue which was originally present in that PR and
which caused it to be reverted.
Related: flutter#190401
### Previously:
- `CreateGradientBuffer` converts a gradient's colors and stops to an
interpolated list of colors. This interpolated list of colors is
converted to bytes with `ToR8G8B8A8()` and is returned in a
`GradientData`.
- The `R8G8B8A8` `GradientData` is passed to `CreateGradientTexture`,
which allocates a `PixelFormat::kR8G8B8A8UNormInt` texture.
Wide gamut colors can't be converted to `R8G8B8A8`, so they end up
getting clamped.
### Now:
- `CreateGradientBuffer` converts a gradient's colors and stops to an
interpolated list of colors (same as before). But now no conversion to
bytes happens here. The interpolated list of colors is directly returned
in a `GradientData`.
- The `Color`-based `GradientData` is passed to `CreateGradientTexture`.
`CreateGradientTexture` now handles the conversion to bytes. If there
are wide gamut colors, it converts to `kR32G32B32A32Float`. Otherwise it
does the old behavior of converting to `PixelFormat::kR8G8B8A8UNormInt`.
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md1 parent 5474d44 commit 1d790af
5 files changed
Lines changed: 115 additions & 42 deletions
File tree
- engine/src/flutter/impeller
- entity/contents
- geometry
Lines changed: 45 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
17 | 46 | | |
18 | 47 | | |
19 | 48 | | |
20 | | - | |
| 49 | + | |
21 | 50 | | |
22 | 51 | | |
23 | 52 | | |
24 | 53 | | |
25 | 54 | | |
26 | 55 | | |
27 | | - | |
28 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
29 | 70 | | |
30 | | - | |
31 | | - | |
| 71 | + | |
32 | 72 | | |
33 | 73 | | |
34 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
223 | 231 | | |
224 | 232 | | |
225 | 233 | | |
| |||
Lines changed: 49 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1820 | 1820 | | |
1821 | 1821 | | |
1822 | 1822 | | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
1823 | 1836 | | |
1824 | 1837 | | |
1825 | 1838 | | |
| |||
1829 | 1842 | | |
1830 | 1843 | | |
1831 | 1844 | | |
1832 | | - | |
1833 | | - | |
| 1845 | + | |
| 1846 | + | |
1834 | 1847 | | |
1835 | 1848 | | |
1836 | 1849 | | |
| |||
1840 | 1853 | | |
1841 | 1854 | | |
1842 | 1855 | | |
1843 | | - | |
| 1856 | + | |
1844 | 1857 | | |
1845 | 1858 | | |
1846 | 1859 | | |
| |||
1855 | 1868 | | |
1856 | 1869 | | |
1857 | 1870 | | |
1858 | | - | |
| 1871 | + | |
1859 | 1872 | | |
1860 | 1873 | | |
1861 | 1874 | | |
| |||
1867 | 1880 | | |
1868 | 1881 | | |
1869 | 1882 | | |
1870 | | - | |
1871 | | - | |
| 1883 | + | |
| 1884 | + | |
1872 | 1885 | | |
1873 | 1886 | | |
1874 | 1887 | | |
| |||
1885 | 1898 | | |
1886 | 1899 | | |
1887 | 1900 | | |
1888 | | - | |
1889 | | - | |
| 1901 | + | |
| 1902 | + | |
1890 | 1903 | | |
1891 | 1904 | | |
1892 | 1905 | | |
| |||
1900 | 1913 | | |
1901 | 1914 | | |
1902 | 1915 | | |
1903 | | - | |
1904 | | - | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
1905 | 1944 | | |
1906 | 1945 | | |
1907 | 1946 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | | - | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 17 | | |
25 | 18 | | |
26 | 19 | | |
| |||
45 | 38 | | |
46 | 39 | | |
47 | 40 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 41 | + | |
54 | 42 | | |
55 | 43 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 44 | + | |
59 | 45 | | |
| 46 | + | |
60 | 47 | | |
61 | 48 | | |
62 | 49 | | |
63 | 50 | | |
64 | 51 | | |
65 | | - | |
| 52 | + | |
66 | 53 | | |
67 | 54 | | |
68 | 55 | | |
69 | 56 | | |
70 | 57 | | |
71 | 58 | | |
72 | 59 | | |
73 | | - | |
| 60 | + | |
74 | 61 | | |
75 | 62 | | |
76 | 63 | | |
| |||
80 | 67 | | |
81 | 68 | | |
82 | 69 | | |
83 | | - | |
| 70 | + | |
84 | 71 | | |
85 | 72 | | |
86 | 73 | | |
| |||
93 | 80 | | |
94 | 81 | | |
95 | 82 | | |
96 | | - | |
| 83 | + | |
97 | 84 | | |
98 | | - | |
| 85 | + | |
99 | 86 | | |
100 | 87 | | |
101 | 88 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | | - | |
| 21 | + | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
0 commit comments