Update RP blend stages to more closely match legacy blends

The legacy SkXfermode blend implementations relied on
`Sk4px::approxMulDiv255`, which ended up in `SkVx::approx_scale`.
Interestingly, `SkVx::div255` is exact (just `(x + 127)/255`), where
RP's div255 has a +/-1 bit approximation on non-NEON.

`approx_scale` also has this same error, but leads to better behavior
when blending. Particularly in the case of the linked bug where
repeated dstout blends were taking an unexpectedly long time to
saturate at `a=0`.

For example, lets say we start with an opaque da=255, and a near opaque
source sa=250. Repeated iterations of the RP dstout produces:
    `(255*(255-250) + 255)/256 = (6*255)/256 = 5`
    `(  5*(255-250) + 255)/256 = 280/256     = 1`
    `(  1*(255-250) + 255)/256 = 260/256     = 1`
    ... and it's stuck at `a=1`

Using the `approx_scale` instead produces the series:
    `(255*(255-250) + 255)/256 = (6*255)/256 = 5`
    `(  5*(255-250) +   5)/256 = 30/256      = 0`

The exact math would produce:
   `(255*(255-250)/255.0 = 5.0` or
       `(255*(255-250) + 127)/255 = 1402/255 = 5`
   `(  5*(255-250)/255.0 = 0.098` or
       `(  5*(255-250) + 127)/255 = 152/255  = 0`

Instead of making an RP clone of approx_scale, this just switches
the blend modes that historically had used approx_scale to use
div255_accurate.

Bug: chromium:145083
Change-Id: Ibe8120461ea7bcd056cea5c60985dd16e8265f54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/708229
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
1 file changed