Create shared DitherUtils for Ganesh and Graphite

This is setting up to reuse these utilities for the Graphite implementation of the DitherShader.

This does change their functionality a bit in that the GrColorTypes w/o a matching SkColorType will no longer be dithered. Similarly, unknown color types will also no longer be dithered. I don't think the first case ever happens (i.e., drawing one of the odd-ball GrColorType images) and the second case (drawing an unknown color type image) is/was just weird.

Here are the newly orphaned GrColorTypes:

// Supposedly only used for readback
kAlpha_8xxx
kAlpha_F32xxx
kGray_8xxx
kR_8xxx

// Supposedly only used to initialize backend textures
kRGB_888
kR_16
kR_F16
kGray_F16
kBGRA_4444
kARGB_4444

// Seems pretty exotic
kGrayAlpha_88

Bug: b/256870077
Change-Id: Ieeeb8e87944438670ace93f1cb3a1485195f7f31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/658916
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
7 files changed