Skip to content

Commit

Permalink
[Impeller] Premultiply gradient alpha after the gradient LUT is gener…
Browse files Browse the repository at this point in the history
…ated (flutter#36064)
  • Loading branch information
bdero committed Sep 10, 2022
1 parent dae737f commit 0b6dcd8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ TEST_P(AiksTest, CanRenderLinearGradient) {
auto tile_mode = tile_modes[selected_tile_mode];
paint.color_source = [tile_mode]() {
std::vector<Color> colors = {Color{0.9568, 0.2627, 0.2118, 1.0},
Color{0.1294, 0.5882, 0.9529, 1.0}};
Color{0.1294, 0.5882, 0.9529, 0.0}};
std::vector<Scalar> stops = {0.0, 1.0};

auto contents = std::make_shared<LinearGradientContents>();
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/linear_gradient_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ void main() {
gradient_info.texture_sampler_y_coord_scale,
gradient_info.tile_mode,
gradient_info.tile_mode);
frag_color = vec4(frag_color.xyz * frag_color.a, frag_color.a);
}
1 change: 1 addition & 0 deletions impeller/entity/shaders/radial_gradient_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ void main() {
gradient_info.texture_sampler_y_coord_scale,
gradient_info.tile_mode,
gradient_info.tile_mode);
frag_color = vec4(frag_color.xyz * frag_color.a, frag_color.a);
}
1 change: 1 addition & 0 deletions impeller/entity/shaders/sweep_gradient_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ void main() {
gradient_info.texture_sampler_y_coord_scale,
gradient_info.tile_mode,
gradient_info.tile_mode);
frag_color = vec4(frag_color.xyz * frag_color.a, frag_color.a);
}
2 changes: 1 addition & 1 deletion impeller/geometry/gradient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace impeller {

static void AppendColor(const Color& color, std::vector<uint8_t>* colors) {
auto converted = color.Premultiply().ToR8G8B8A8();
auto converted = color.ToR8G8B8A8();
colors->push_back(converted[0]);
colors->push_back(converted[1]);
colors->push_back(converted[2]);
Expand Down

0 comments on commit 0b6dcd8

Please sign in to comment.