Add support for readPixels on gpu backend ImageGenerators.

Currently SkImageGenerators that use GPU backend texture do not
implement onGetPixels and instead only implement onGenerateTexture.
The readPixels call on SkImage_Lazy only tries to use getPixels
call and thus fails for all GPU backend generators.

This CL changes the SkImage_Lazy::getROPixels to try and call
generateTexture if ImageGenerator::getPixels call fails.
If we get a texture we then use our normal
SurfaceContext::readPixels calls to read the pixels from the
entire texture into the target Bitmap.

Adding this logic to happen in getROPixels should make it
work for readPixels calls, as well as when drawing a
SkPicture containing a texture-backed lazy image
into a raster surface, provided GrDirectContext is passed
into the drawPicture and related calls (see follow-on CL).

Also add support for the use of this readPixels in CanvasKit.

Change-Id: Ia6fdf4a9216d4e6d136c13aac7820d986ced2fd9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557100
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
10 files changed