0

Serialize color interpolation spaces for gradients

In crrev.com/c/3988245 new gradient interpolation spaces were hooked
into the skia code, but they were not being properly serialized in the
PaintOp reader/writer. This meant that they worked with
--single-process enabled (and thus worked in the tests that were
added), but did not work with GPU raster enabled.

This CL adds explicit read/write for the new interpolation parameters
of a PaintShader.

We've also added the 15 tests in the css-images/gradient folder to the
gpu-rasterization virtual test suite so that we can catch
regressions like this in the future. These tests fail without the new
code.

css3/blending/effect-background-blend-mode-stacking.html needs to be
rebaselined because previously it was blending with unpremultiplied
alpha. Now that we are properly serializing things we're blending
in premultiplied alpha, which matches the CPU path and the spec:
https://csswg.sesse.net/css-color-4/#interpolation-alpha

Bug: 1362022
Change-Id: Id39559a902723b3a6d5b69bac7d2b503702cdff8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4006374
Reviewed-by: Philip Rogers <pdr@chromium.org>
Reviewed-by: Robert Flack <flackr@chromium.org>
Commit-Queue: Aaron Krajeski <aaronhk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1068824}
This commit is contained in:
Aaron Krajeski
2022-11-08 22:26:57 +00:00
committed by Chromium LUCI CQ
parent 508deea203
commit 7ce97a4432
4 changed files with 4 additions and 1 deletions
cc/paint
third_party/blink/web_tests
VirtualTestSuites
flag-specific
skia-vulkan-swiftshader

@@ -532,6 +532,7 @@ void PaintOpReader::Read(sk_sp<PaintShader>* shader) {
ReadSimple(&ref.end_point_);
ReadSimple(&ref.start_degrees_);
ReadSimple(&ref.end_degrees_);
ReadSimple(&ref.gradient_interpolation_);
Read(&ref.image_);
bool has_record = false;
ReadSimple(&has_record);

@@ -514,6 +514,7 @@ void PaintOpWriter::Write(const PaintShader* shader,
WriteSimple(shader->end_point_);
WriteSimple(shader->start_degrees_);
WriteSimple(shader->end_degrees_);
WriteSimple(shader->gradient_interpolation_);
if (enable_security_constraints_) {
DrawImage draw_image(shader->image_, false, MakeSrcRect(shader->image_),

@@ -111,7 +111,8 @@
{
"prefix": "gpu-rasterization",
"platforms": ["Linux", "Mac", "Win"],
"bases": ["images"],
"bases": ["images",
"external/wpt/css/css-images/gradient"],
"args": ["--enable-gpu-rasterization"]
},
{

Binary file not shown.

Before

(image error) Size: 86 KiB

After

(image error) Size: 80 KiB