mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
part of fix for bug 104999. r=jag sr=jst
This commit is contained in:
parent
155ac84ad2
commit
85a8762e4f
@ -866,5 +866,5 @@ term_source (j_decompress_ptr jd)
|
|||||||
src->decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
|
src->decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No work necessary here */
|
src->decoder->mFrame->SetMutable(PR_FALSE);
|
||||||
}
|
}
|
||||||
|
@ -537,5 +537,9 @@ end_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
decoder->mObserver->OnStopContainer(nsnull, nsnull, decoder->mImage);
|
decoder->mObserver->OnStopContainer(nsnull, nsnull, decoder->mImage);
|
||||||
decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
|
decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We are never going to change the data of this frame again. Let the OS
|
||||||
|
// do what it wants with this image.
|
||||||
|
decoder->mFrame->SetMutable(PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public
|
* The contents of this file are subject to the Mozilla Public
|
||||||
* License Version 1.1 (the "License"); you may not use this file
|
* License Version 1.1 (the "License"); you may not use this file
|
||||||
|
@ -26,13 +26,13 @@
|
|||||||
#include "imgContainer.h"
|
#include "imgContainer.h"
|
||||||
|
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
#include "nsIImage.h"
|
||||||
#include "nsIInterfaceRequestor.h"
|
#include "nsIInterfaceRequestor.h"
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
#include "nsIInterfaceRequestorUtils.h"
|
||||||
#include "gfxIImageFrame.h"
|
#include "gfxIImageFrame.h"
|
||||||
#include "nsIImage.h"
|
|
||||||
#include "nsMemory.h"
|
#include "nsMemory.h"
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS3(imgContainer, imgIContainer, nsITimerCallback,imgIDecoderObserver)
|
NS_IMPL_ISUPPORTS3(imgContainer, imgIContainer, nsITimerCallback, imgIDecoderObserver)
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
imgContainer::imgContainer() :
|
imgContainer::imgContainer() :
|
||||||
@ -105,10 +105,13 @@ NS_IMETHODIMP imgContainer::GetHeight(nscoord *aHeight)
|
|||||||
/* readonly attribute gfxIImageFrame currentFrame; */
|
/* readonly attribute gfxIImageFrame currentFrame; */
|
||||||
NS_IMETHODIMP imgContainer::GetCurrentFrame(gfxIImageFrame * *aCurrentFrame)
|
NS_IMETHODIMP imgContainer::GetCurrentFrame(gfxIImageFrame * *aCurrentFrame)
|
||||||
{
|
{
|
||||||
if (mCompositingFrame)
|
if (mCompositingFrame) {
|
||||||
return mCompositingFrame->QueryInterface(NS_GET_IID(gfxIImageFrame), (void**)aCurrentFrame); // addrefs again
|
*aCurrentFrame = mCompositingFrame;
|
||||||
else
|
NS_ADDREF(*aCurrentFrame);
|
||||||
return this->GetFrameAt(mCurrentAnimationFrameIndex, aCurrentFrame);
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->GetFrameAt(mCurrentAnimationFrameIndex, aCurrentFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
@ -162,10 +165,14 @@ NS_IMETHODIMP imgContainer::AppendFrame(gfxIImageFrame *item)
|
|||||||
(numFrames >= 1)) // Not sure if I want to create a composite frame for every anim. Could be smarter.
|
(numFrames >= 1)) // Not sure if I want to create a composite frame for every anim. Could be smarter.
|
||||||
{
|
{
|
||||||
mCompositingFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
|
mCompositingFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
|
||||||
mCompositingFrame->Init(0, 0, mSize.width, mSize.height, gfxIFormats::RGB_A1);
|
mCompositingFrame->Init(0, 0, mSize.width, mSize.height, gfxIFormats::RGB_A1);
|
||||||
nsCOMPtr<nsIImage> img(do_GetInterface(mCompositingFrame));
|
|
||||||
img->SetDecodedRect(0, 0, mSize.width, mSize.height);
|
nsCOMPtr<nsIInterfaceRequestor> ireq(do_QueryInterface(mCompositingFrame));
|
||||||
|
if (ireq) {
|
||||||
|
nsCOMPtr<nsIImage> img(do_GetInterface(ireq));
|
||||||
|
img->SetDecodedRect(0, 0, mSize.width, mSize.height);
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<gfxIImageFrame> firstFrame;
|
nsCOMPtr<gfxIImageFrame> firstFrame;
|
||||||
this->GetFrameAt(0, getter_AddRefs(firstFrame));
|
this->GetFrameAt(0, getter_AddRefs(firstFrame));
|
||||||
|
|
||||||
@ -243,6 +250,14 @@ NS_IMETHODIMP imgContainer::EndFrameDecode(PRUint32 aFrameNum, PRUint32 aTimeout
|
|||||||
NS_IMETHODIMP imgContainer::DecodingComplete(void)
|
NS_IMETHODIMP imgContainer::DecodingComplete(void)
|
||||||
{
|
{
|
||||||
mDoneDecoding = PR_TRUE;
|
mDoneDecoding = PR_TRUE;
|
||||||
|
|
||||||
|
PRUint32 numFrames;
|
||||||
|
mFrames.Count(&numFrames);
|
||||||
|
if (numFrames == 1) {
|
||||||
|
nsCOMPtr<gfxIImageFrame> currentFrame;
|
||||||
|
GetFrameAt(0, getter_AddRefs(currentFrame));
|
||||||
|
currentFrame->SetMutable(PR_FALSE);
|
||||||
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,7 +583,7 @@ NS_IMETHODIMP imgContainer::OnDataAvailable(imgIRequest *aRequest, nsISupports *
|
|||||||
aFrame->DrawTo(mCompositingFrame, x, aRect->y, aRect->width, aRect->height);
|
aFrame->DrawTo(mCompositingFrame, x, aRect->y, aRect->width, aRect->height);
|
||||||
BuildCompositeMask(mCompositingFrame, aFrame);
|
BuildCompositeMask(mCompositingFrame, aFrame);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user