Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9c3f66d

Browse files
Reverts "Reland: Framework wide color (#54415) (#54737)" (#54885)
Reverts: #54737 Initiated by: chingjun Reason for reverting: Breaking internal tests. See b/363125155 Original PR Author: gaaclarke Reviewed By: {matanlurey, jonahwilliams} This change reverts the following previous change: [This PR](#54415) was reverted because it requires a manual roll into the framework. issue: flutter/flutter#127855 integration test: #54415 This does the preliminary work for implementing wide gamut colors in the Flutter framework. Here are the following changes: 1) colors now specify a colorspace with which they are to be interpreted 1) colors now store their components as floats to accommodate bit depths more than 8 The storage of this Color class is weird with float/int storage but that is a temporary solution to support a smooth transition. Here is the plan for landing this: 1) Land this PR 1) Wait for it to roll into the Framework 1) Land flutter/flutter#153938 which will make CupertinoDynamicColor implement Color 1) Land another engine PR that rips out the int storage: #54714 Here are follow up PRs: 1) #54473 - changes DlColor so the wide gamut colors are rendered 1) #54567 - Hooks up these changes to take advantage of wide DlColor 1) flutter/flutter#153319 - the integration test for the framework repo There are some things that have been left as follow up PRs since they are technically breaking: 1) The math on `lerp` hasn't been updated to take advantage of the higher bit depth 1) `operator==` hasn't been updated to take advantage of the higher bit depth 1) `hashCode` hasn't been updated to take advantage of the higher bit depth 1) `alphaBlend` hasn't been updated to take advantage of the higher bit depth 1) `toString` hasn't been updated to take advantage of the higher bit depth
1 parent 57ced5a commit 9c3f66d

File tree

6 files changed

+80
-811
lines changed

6 files changed

+80
-811
lines changed

lib/gpu/lib/src/render_pass.dart

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,6 @@ base class RenderTarget {
9595
final DepthStencilAttachment? depthStencilAttachment;
9696
}
9797

98-
// TODO(gaaclarke): Refactor this to support wide gamut colors.
99-
int _colorToInt(ui.Color color) {
100-
assert(color.colorSpace == ui.ColorSpace.sRGB);
101-
return ((color.a * 255.0).round() << 24) |
102-
((color.r * 255.0).round() << 16) |
103-
((color.g * 255.0).round() << 8) |
104-
((color.b * 255.0).round() << 0);
105-
}
106-
10798
base class RenderPass extends NativeFieldWrapperClass1 {
10899
/// Creates a new RenderPass.
109100
RenderPass._(CommandBuffer commandBuffer, RenderTarget renderTarget) {
@@ -114,7 +105,7 @@ base class RenderPass extends NativeFieldWrapperClass1 {
114105
index,
115106
color.loadAction.index,
116107
color.storeAction.index,
117-
_colorToInt(color.clearValue),
108+
color.clearValue.value,
118109
color.texture,
119110
color.resolveTexture);
120111
if (error != null) {

lib/ui/lerp.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ double? lerpDouble(num? a, num? b, double t) {
2626
///
2727
/// Same as [lerpDouble] but specialized for non-null `double` type.
2828
double _lerpDouble(double a, double b, double t) {
29-
return a + (b - a) * t;
29+
return a * (1.0 - t) + b * t;
3030
}
3131

3232
/// Linearly interpolate between two integers.

0 commit comments

Comments
 (0)