raster 8888 pow2 samples hack

The gist here is to use saveLayer() to create a buffer to draw each
subframe into, but not actually use it to draw anything at restore()
time, hence, canvas->clear(0).  (SkCanvas sniffs out cleverer approaches
like 0 alpha or SkBlendMode::kDst.)

Instead, we accessTopLayerPixels() and slurp the subframe out into a
16-bit accumulator, then when all subframes have drawn and accumulated
there, one more saveLayer() and accessTopLayerPixels() lets us put them
back, shifting back down to 8-bit.

The hot parts of the profile are drawing the frames themselves, then the
accumulate / repack code in renderToRaster8888Pow2Samples().

  $ time out/skottie_tool -i ~/Downloads/mb/data.json -w bar
  Before: 28.39user 1.14system 0:29.54elapsed
  After:  22.08user 1.12system 0:23.21elapsed

    I'm not proud of it.
    ...
    ...
    ...
    I am a bit!

Now using one layer.

Change-Id: I241529fad4c5b55c6abc55793f2d9c9693a03c18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242853
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2 files changed