fixed premultiplied colors for antialiased colors (#165839)

Previously line.frag was serving up unpremultiplied colors. This
resulted in weird blending and the antialiasing not showing up in most
cases.

test: existing golden will change

## 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].
- [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].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[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.md
This commit is contained in:
gaaclarke
2025-03-25 14:11:46 -07:00
committed by GitHub
parent bf451c436b
commit cc845eb463
3 changed files with 21 additions and 19 deletions

View File

@@ -162,7 +162,7 @@ bool LineContents::Render(const ContentContext& renderer,
VS::FrameInfo frame_info;
FS::FragInfo frag_info;
frag_info.color = color_.Premultiply();
frag_info.color = color_;
PipelineBuilderCallback pipeline_callback =
[&renderer](ContentContextOptions options) {

View File

@@ -4,6 +4,7 @@
precision mediump float;
#include <impeller/color.glsl>
#include <impeller/types.glsl>
uniform FragInfo {
@@ -41,4 +42,5 @@ float CalculateLine() {
void main() {
float line = CalculateLine();
frag_color = vec4(frag_info.color.xyz, line);
frag_color = IPPremultiply(frag_color);
}

View File

@@ -4431,16 +4431,16 @@
"uses_late_zs_update": false,
"variants": {
"Main": {
"fp16_arithmetic": 6,
"fp16_arithmetic": 0,
"has_stack_spilling": false,
"performance": {
"longest_path_bound_pipelines": [
"varying"
],
"longest_path_cycles": [
0.21875,
0.140625,
0.21875,
0.1875,
0.1875,
0.1875,
0.0,
0.0,
1.75,
@@ -4459,9 +4459,9 @@
"varying"
],
"shortest_path_cycles": [
0.140625,
0.125,
0.140625,
0.171875,
0.171875,
0.109375,
0.0,
0.0,
1.75,
@@ -4471,9 +4471,9 @@
"varying"
],
"total_cycles": [
0.21875,
0.140625,
0.21875,
0.1875,
0.1875,
0.1875,
0.0,
0.0,
1.75,
@@ -8251,7 +8251,7 @@
"uses_late_zs_update": false,
"variants": {
"Main": {
"fp16_arithmetic": 15,
"fp16_arithmetic": 33,
"has_stack_spilling": false,
"performance": {
"longest_path_bound_pipelines": [
@@ -8259,8 +8259,8 @@
],
"longest_path_cycles": [
0.1875,
0.140625,
0.1875,
0.171875,
0.15625,
0.1875,
0.0,
1.75,
@@ -8280,8 +8280,8 @@
],
"shortest_path_cycles": [
0.1875,
0.125,
0.140625,
0.15625,
0.109375,
0.1875,
0.0,
1.75,
@@ -8292,8 +8292,8 @@
],
"total_cycles": [
0.1875,
0.140625,
0.1875,
0.171875,
0.15625,
0.1875,
0.0,
1.75,
@@ -8302,7 +8302,7 @@
},
"stack_spill_bytes": 0,
"thread_occupancy": 100,
"uniform_registers_used": 6,
"uniform_registers_used": 4,
"work_registers_used": 18
}
}