mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Decode using the last cached required frame (#7715)
`MultiFrameCodec` now uses whatever previously cached required frame is available instead of panicking if it doesn't have the exact frame requested by `SkCodec::FrameInfo#fRequiredFrame`. `SkCodec::FrameInfo#fRequiredFrame` doesn't point to the one and only frame that's required to decode the given frame. It points to the latest frame that's disposal method none and filling a greater surface area than the current frame. The last required frame `MultiFrameCodec` has actually cached is also valid in these cases and can be supplied as `fPriorFrame` instead. [flutter/flutter#26757](https://github.com/flutter/flutter/issues/26757#issuecomment-459522530) has a more detailed explanation. Fixes flutter/flutter#26757
This commit is contained in:
parent
4f3eb42dfd
commit
b0370c13c3
@ -408,11 +408,15 @@ sk_sp<SkImage> MultiFrameCodec::GetNextFrameImage(
|
||||
options.fFrameIndex = nextFrameIndex_;
|
||||
const int requiredFrameIndex = frameInfos_[nextFrameIndex_].fRequiredFrame;
|
||||
if (requiredFrameIndex != SkCodec::kNoFrame) {
|
||||
if (lastRequiredFrame_ == nullptr ||
|
||||
lastRequiredFrameIndex_ != requiredFrameIndex) {
|
||||
if (lastRequiredFrame_ == nullptr) {
|
||||
FML_LOG(ERROR) << "Frame " << nextFrameIndex_ << " depends on frame "
|
||||
<< requiredFrameIndex << " which has not been cached.";
|
||||
<< requiredFrameIndex
|
||||
<< " and no required frames are cached.";
|
||||
return NULL;
|
||||
} else if (lastRequiredFrameIndex_ != requiredFrameIndex) {
|
||||
FML_DLOG(INFO) << "Required frame " << requiredFrameIndex
|
||||
<< " is not cached. Using " << lastRequiredFrameIndex_
|
||||
<< " instead";
|
||||
}
|
||||
|
||||
if (lastRequiredFrame_->getPixels() &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user