Don't read whole stream on SkWebpCodec creation

Our implementation of Skia data structures is sub-optimal if one
wants to create an SkCodec but not get the pixels yet (This may be done
to just get information about the file as used in this API [1]). Before
this change, the function SkCopyStreamToData would automatically read
through the entire stream and copy it to a new SkData object. This CL
changes that to only read through necessary information and then read
the rest later if needed.

Information about the format was taken from [2]. We read through each
chunk until we reach image data, either vp8 or vp8L. We then read the
header of the image data (for vp8 should be up to 10 bytes [3] or for
vp8L 5 bytes [4]). For animated frames, we want the whole frame in order
to create the SkCodec so we read all of that image data. We add a new
member variable to SkWebpCodec that tells us if we have only read the
header, if so we read the rest of the stream and append it to the data
that we already have, making a new demux object which should be
inexpensive[5].

[1]
https://developer.android.com/reference/android/graphics/BitmapFactory.Options#inJustDecodeBounds

[2] https://developers.google.com/speed/webp/docs/riff_container

[3] https://datatracker.ietf.org/doc/html/rfc6386#section-4

[4]
https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification#7_overall_structure_of_the_format

[5]
https://chromium.googlesource.com/webm/libwebp/+/0.4.2/src/webp/demux.h#101

Bug: 158580821
Change-Id: I444c0c5c5c6df01a91962128b810fa9eba399d35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/989596
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Daniel Dilan <danieldilan@google.com>
2 files changed