[rust png] Don't retry `parse...FrameInfos` if input didn't change.

This CL implements the following performance micro-optimization (the
root of all evil :-/): Don't retry `parseAdditionalFrameInfos` if the
input stream's length didn't change.  This CL will hopefully minimize
the performance impact of https://crbug.com/371060427 when (say) half
the APNG frames are available.  Without this CL, if `getFrameCount` is
called after decoding a frame, then `SkPngRustCodec` will consume all
the input in an attempt to discover additional `fcTL` chunks.  And this
means that decoding subsequent frames will require rewinding the stream
and seeking to the right stream position (slow, unless we fully address
https://crbug.com/371060427).  And if there is no additional data, then
trying to discover additional `fcTL` chunks is futile.

Bug: chromium:371060427
Change-Id: I9ac5cd1c65a4bd27d6516b50b750430fc97beee0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/913918
Commit-Queue: Ɓukasz Anforowicz <lukasza@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2 files changed