[Impeller] Premultiply gradient alpha after the gradient LUT is generated (flutter/engine#36064)

This commit is contained in:
Brandon DeRosier
2022-09-09 18:06:18 -07:00
committed by GitHub
parent 6e87e08277
commit 0fc3da0f4b
5 changed files with 5 additions and 2 deletions

View File

@@ -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>();

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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]);