mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 854287 - Don't send partial invalidations for images which have already been decoded. r=joe
This commit is contained in:
parent
b901b1165d
commit
967dc3d20c
@ -300,7 +300,8 @@ imgStatusTracker::imgStatusTracker(Image* aImage)
|
||||
mState(0),
|
||||
mImageStatus(imgIRequest::STATUS_NONE),
|
||||
mIsMultipart(false),
|
||||
mHadLastPart(false)
|
||||
mHadLastPart(false),
|
||||
mHasBeenDecoded(false)
|
||||
{
|
||||
mTrackerObserver = new imgStatusTrackerObserver(this);
|
||||
}
|
||||
@ -534,7 +535,6 @@ imgStatusTracker::CalculateAndApplyDifference(imgStatusTracker* other)
|
||||
// with the other tracker.
|
||||
|
||||
// First, actually synchronize our state.
|
||||
diff.mInvalidRect = mInvalidRect.Union(other->mInvalidRect);
|
||||
mState |= diff.mDiffState | loadState;
|
||||
if (diff.mUnblockedOnload) {
|
||||
mState &= ~stateBlockingOnload;
|
||||
@ -543,6 +543,7 @@ imgStatusTracker::CalculateAndApplyDifference(imgStatusTracker* other)
|
||||
mIsMultipart = other->mIsMultipart;
|
||||
mHadLastPart = other->mHadLastPart;
|
||||
mImageStatus |= other->mImageStatus;
|
||||
mHasBeenDecoded = mHasBeenDecoded || other->mHasBeenDecoded;
|
||||
|
||||
// The error state is sticky and overrides all other bits.
|
||||
if (mImageStatus & imgIRequest::STATUS_ERROR) {
|
||||
@ -554,9 +555,19 @@ imgStatusTracker::CalculateAndApplyDifference(imgStatusTracker* other)
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the invalid rectangles for another go.
|
||||
other->mInvalidRect.SetEmpty();
|
||||
mInvalidRect.SetEmpty();
|
||||
// Only record partial invalidations if we haven't been decoded before.
|
||||
// When images are re-decoded after discarding, we don't want to display
|
||||
// partially decoded versions to the user.
|
||||
bool doInvalidations = !mHasBeenDecoded
|
||||
|| mImageStatus & imgIRequest::STATUS_ERROR
|
||||
|| mImageStatus & imgIRequest::STATUS_DECODE_COMPLETE;
|
||||
|
||||
// Record the invalid rectangles and reset them for another go.
|
||||
if (doInvalidations) {
|
||||
diff.mInvalidRect = mInvalidRect.Union(other->mInvalidRect);
|
||||
other->mInvalidRect.SetEmpty();
|
||||
mInvalidRect.SetEmpty();
|
||||
}
|
||||
|
||||
return diff;
|
||||
}
|
||||
@ -768,6 +779,7 @@ imgStatusTracker::RecordStopDecode(nsresult aStatus)
|
||||
if (NS_SUCCEEDED(aStatus) && mImageStatus != imgIRequest::STATUS_ERROR) {
|
||||
mImageStatus |= imgIRequest::STATUS_DECODE_COMPLETE;
|
||||
mImageStatus &= ~imgIRequest::STATUS_DECODE_STARTED;
|
||||
mHasBeenDecoded = true;
|
||||
// If we weren't successful, clear all success status bits and set error.
|
||||
} else {
|
||||
mImageStatus = imgIRequest::STATUS_ERROR;
|
||||
|
@ -246,6 +246,7 @@ private:
|
||||
uint32_t mImageStatus;
|
||||
bool mIsMultipart : 1;
|
||||
bool mHadLastPart : 1;
|
||||
bool mHasBeenDecoded : 1;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user