Allow translucent shapes to be detected as solid colors.

This CL modifies the SolidColorAnalyzer so that a color is not required
to be opaque to be considered solid. The motivation is that in the
rendering.desktop:blur_rotating_background story, the two blurring
foregrounds were being drawn as texture quads because they are
translucent. With this CL, they can be drawn as solid color quads thus
avoiding textures.

The initial change (patchset #3) was relatively simple: remove the
alpha == 255 restriction from the IsSolidColor() function and possibly
do a manual SrcOver alpha blend in case, e.g., a translucent drawRect is
done on top of another drawRect. The blend code was adapted from
ui/gfx/color_utils.cc::AlphaBlend().

Unfortunately, this caused some web_tests failures (see patchset #4).
Although the differences are not visible, two of the tests are not shown
in Gerrit because they could not be rebaselined since they're reftests:
compositing/background-color/background-color-alpha.html and
virtual/stable/compositing/background-color/background-color-alpha.html.
My exploration suggested rounding problems in the alpha
premultiplication prior to setting the solid color uniform in the GL
shader, so I changed the PremultipliedColor() function in gl_renderer.cc
to use a similar premultiplication logic as
SkARGB32_Blitter::SkARGB32_Blitter [1], and now all relevant web_tests
pass (see patchset #5).

After this, there were some unit test failures in cc and viz. I
addressed the cc failures by making FakeRasterSource::CreateFilled()
return a non-solid-color raster source to ensure that picture layers
using it can have tilings. I addressed the viz failure by rebaselining
the failed test as the visual difference is very little (there is a
difference but it's hard to appreciate in Gerrit). While fixing these
failures, I discovered a bug in my previous solid color code changes
where a raster source was incorrectly being detected as solid color in
certain cases. I fixed that bug and added test cases. All this was done
as of patchset #8.

[1] https://cs.chromium.org/chromium/src/third_party/skia/src/core/SkBlitter_ARGB32.cpp?l=676-680&rcl=ccb0a307c136760e0b0c33c4f66c3e58a3f98334

Bug: 917058
Test: foregrounds in the story are now drawn as solid color quads.
Change-Id: I6d70ccb7c28b356cfbc81a856a17192b6d743933
Reviewed-on: https://chromium-review.googlesource.com/c/1387385
Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622972}
5 files changed