Leverage readPixels to simplify PDF bitmap output

This keeps the special handling for Alpha8 and Gray8. All other formats
are converted to 8888. To make everything simpler, we always convert to
kBGRA, so we can just use SkColor macros to get the components.

This maintains the neighbor-averaging for fully transparent pixels, but
the implementation is slightly different. Before, we averaged RGB and A
while the pixels were premul, then unpremultiplied. Now, we pre-convert
everything to unpremul, then just average RGB over the (not fully
transparent) neighbors.

Bug: skia:
Change-Id: Ib5a0d8536e2507952a44365347518b2d57d07549
Reviewed-on: https://skia-review.googlesource.com/c/167660
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
1 file changed