Commit d941c612 authored by Wan-Teh Chang's avatar Wan-Teh Chang Committed by Commit Bot

Avoid using the image_data_ member

A future CL will eliminate the image_data_ member. Replace the use of
image_data_ in the ImageHasBothStillAndAnimatedSubImages() method with
direct use of the data_ member.

Change-Id: Idd086243eb7aed6c72b0253ef15ee2c2cb49b427
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536085Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827101}
parent be265fd1
......@@ -463,10 +463,17 @@ bool AVIFImageDecoder::ImageHasBothStillAndAnimatedSubImages() const {
// TODO(wtc): We should rely on libavif to tell us if the file has both an
// image and an animation track instead of just checking the major brand.
constexpr base::StringPiece kAnimationType = "avis";
char buf[kAnimationType.size() + 1] = {0};
image_data_->copyRange(8, kAnimationType.size(), &buf);
return kAnimationType == buf;
//
// An AVIF image begins with a file‐type box 'ftyp':
// unsigned int(32) size;
// unsigned int(32) type = boxtype; // boxtype is 'ftyp'
// unsigned int(32) major_brand;
// ...
FastSharedBufferReader fast_reader(data_);
char buf[4];
const char* major_brand = fast_reader.GetConsecutiveData(8, 4, buf);
// The brand 'avis' is an AVIF image sequence (animation) brand.
return memcmp(major_brand, "avis", 4) == 0;
}
// static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment