mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 517543 - need a STATUS_DECODE_COMPLETE for imgIRequest.r=joe
This commit is contained in:
parent
9758ecee67
commit
ba376437d0
@ -2175,8 +2175,10 @@ nsTreeBodyFrame::GetImage(PRInt32 aRowIndex, nsTreeColumn* aCol, PRBool aUseCont
|
||||
imgIRequest *imgReq = entry.request;
|
||||
imgReq->GetImageStatus(&status);
|
||||
imgReq->GetImage(aResult); // We hand back the image here. The GetImage call addrefs *aResult.
|
||||
PRBool animated = PR_FALSE;
|
||||
if (*aResult)
|
||||
PRBool animated = PR_TRUE; // Assuming animated is the safe option
|
||||
|
||||
// We can only call GetAnimated if we're decoded
|
||||
if (*aResult && (status & imgIRequest::STATUS_DECODE_COMPLETE))
|
||||
(*aResult)->GetAnimated(&animated);
|
||||
|
||||
if ((!(status & imgIRequest::STATUS_LOAD_COMPLETE)) || animated) {
|
||||
|
@ -85,7 +85,10 @@ interface imgIContainer : nsISupports
|
||||
readonly attribute PRInt32 height;
|
||||
|
||||
/**
|
||||
* Whether this image is animated.
|
||||
* Whether this image is animated. You can only be guaranteed that querying
|
||||
* this will not throw if STATUS_DECODE_COMPLETE is set on the imgIRequest.
|
||||
*
|
||||
* @throws NS_ERROR_NOT_AVAILABLE if the animated state cannot be determined.
|
||||
*/
|
||||
readonly attribute boolean animated;
|
||||
|
||||
|
@ -90,6 +90,8 @@ interface imgIRequest : nsIRequest
|
||||
*
|
||||
* STATUS_FRAME_COMPLETE: The first frame has been
|
||||
* completely decoded.
|
||||
*
|
||||
* STATUS_DECODE_COMPLETE: The whole image has been decoded.
|
||||
*/
|
||||
//@{
|
||||
const long STATUS_NONE = 0x0;
|
||||
@ -98,6 +100,7 @@ interface imgIRequest : nsIRequest
|
||||
const long STATUS_LOAD_COMPLETE = 0x4;
|
||||
const long STATUS_ERROR = 0x8;
|
||||
const long STATUS_FRAME_COMPLETE = 0x10;
|
||||
const long STATUS_DECODE_COMPLETE = 0x20;
|
||||
//@}
|
||||
|
||||
/**
|
||||
|
@ -152,6 +152,7 @@ imgContainer::imgContainer() :
|
||||
mDiscardTimer(nsnull),
|
||||
mHasSourceData(PR_FALSE),
|
||||
mDecoded(PR_FALSE),
|
||||
mHasBeenDecoded(PR_FALSE),
|
||||
mDecoder(nsnull),
|
||||
mWorker(nsnull),
|
||||
mBytesDecoded(0),
|
||||
@ -299,6 +300,7 @@ NS_IMETHODIMP imgContainer::ExtractFrame(PRUint32 aWhichFrame,
|
||||
img->Init(nsnull, "", INIT_FLAG_NONE);
|
||||
img->SetSize(aRegion.width, aRegion.height);
|
||||
img->mDecoded = PR_TRUE; // Also, we need to mark the image as decoded
|
||||
img->mHasBeenDecoded = PR_TRUE;
|
||||
|
||||
// If a synchronous decode was requested, do it
|
||||
if (aFlags & FLAG_SYNC_DECODE) {
|
||||
@ -483,8 +485,20 @@ NS_IMETHODIMP imgContainer::GetAnimated(PRBool *aAnimated)
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aAnimated);
|
||||
|
||||
*aAnimated = (mAnim != nsnull);
|
||||
|
||||
// If we have mAnim, we can know for sure
|
||||
if (mAnim) {
|
||||
*aAnimated = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Otherwise, we need to have been decoded to know for sure, since if we were
|
||||
// decoded at least once mAnim would have been created for animated images
|
||||
if (!mHasBeenDecoded)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
// We know for sure
|
||||
*aAnimated = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -953,6 +967,7 @@ NS_IMETHODIMP imgContainer::DecodingComplete(void)
|
||||
// XXX - these should probably be combined when we fix animated image
|
||||
// discarding with bug 500402.
|
||||
mDecoded = PR_TRUE;
|
||||
mHasBeenDecoded = PR_TRUE;
|
||||
if (mAnim)
|
||||
mAnim->doneDecoding = PR_TRUE;
|
||||
|
||||
|
@ -327,6 +327,7 @@ private: // data
|
||||
|
||||
// Do we have the frames in decoded form?
|
||||
PRBool mDecoded;
|
||||
PRBool mHasBeenDecoded;
|
||||
|
||||
friend class imgDecodeWorker;
|
||||
|
||||
|
@ -681,6 +681,10 @@ NS_IMETHODIMP imgRequest::OnStopDecode(imgIRequest *aRequest,
|
||||
// entry size to take this into account.
|
||||
UpdateCacheEntrySize();
|
||||
|
||||
// If we were successful, set STATUS_DECODE_COMPLETE
|
||||
if (NS_SUCCEEDED(aStatus))
|
||||
mImageStatus |= imgIRequest::STATUS_DECODE_COMPLETE;
|
||||
|
||||
// ImgContainer and everything below it is completely correct and
|
||||
// bulletproof about its handling of decoder notifications.
|
||||
// Unfortunately, here and above we have to make some gross and
|
||||
@ -711,7 +715,8 @@ NS_IMETHODIMP imgRequest::OnDiscard(imgIRequest *aRequest)
|
||||
mState &= ~stateBitsToClear;
|
||||
|
||||
// Clear the status bits we no longer deserve.
|
||||
PRUint32 statusBitsToClear = imgIRequest::STATUS_FRAME_COMPLETE;
|
||||
PRUint32 statusBitsToClear = imgIRequest::STATUS_FRAME_COMPLETE
|
||||
| imgIRequest::STATUS_DECODE_COMPLETE;
|
||||
mImageStatus &= ~statusBitsToClear;
|
||||
|
||||
// Update the cache entry size, since we just got rid of frame data
|
||||
|
Loading…
Reference in New Issue
Block a user