SkColorFilters::WithWorkingFormat

https://docs.google.com/document/d/1z9ZODlZX4XXbfOjh2t1-1Z7FJcCCcOfbrEjiFzPE4vg/edit?usp=sharing&resourcekey=0-Io-07D1zm1yKMQN2UAiYBw

This approach lets us write color filters that want to work in
particular color spaces and alpha formats and adapt them to our normal
pipeline.  It should work with pre-canned and runtime effects, and we
can do the same sort of thing for shaders too.

Some features are designed for using this with the high-contrast filter:

   - ability to change working tf and gamut separately: as written the
     HC effect only wants to work in linear space without changing
     gamut, which is I bet will be a common desired mode.  But other
     effects may want to fully change the working color space, e.g. to
     sRGB or XYZ.

   - adapting the alpha type to unpremul is mostly a flourish: you could
     do it yourself in sksl, but we might as well do it if doing other
     transforms anyway (it's cheaper this way than doing it yourself),
     and this may make it easier to adapt non-runtime effects.
     (I bet most color filters actually want to be unpremul.)

I briefly also included a knob to control how this effect treats a
nullptr dst color space, but I've come back around to that not being a
parameter.  I think this is a situation where we know best.

New GM to demo.

Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I420e3a2aa648f314c019a98bfdcd44e810a3dac6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368336
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
3 files changed