зеркало из https://github.com/mozilla/gecko-dev.git
Bug 867758 - Add an imgIContainer getter for the first frame's delay time. r=seth
--HG-- extra : rebase_source : aaedf6ee810ca8fcd8979abb5467da4420437bad
This commit is contained in:
Родитель
ffc71066f7
Коммит
298cd10406
|
@ -57,7 +57,7 @@ native nsSize(nsSize);
|
|||
*
|
||||
* Internally, imgIContainer also manages animation of images.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(e385f907-9a59-419b-8e15-e2a96d8ce044)]
|
||||
[scriptable, builtinclass, uuid(4c04b27c-7a4b-4676-b04f-402ace3c3dca)]
|
||||
interface imgIContainer : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -293,4 +293,14 @@ interface imgIContainer : nsISupports
|
|||
* @param aWhichFrame Frame specifier of the FRAME_* variety.
|
||||
*/
|
||||
[notxpcom] float getFrameIndex(in uint32_t aWhichFrame);
|
||||
|
||||
/*
|
||||
* Returns the delay, in ms, between the first and second frame. If this
|
||||
* returns 0, there is no delay between first and second frame (i.e., this
|
||||
* image could render differently whenever it draws).
|
||||
*
|
||||
* If this image is not animated, or not known to be animated (see attribute
|
||||
* animated), returns -1.
|
||||
*/
|
||||
[notxpcom] int32_t getFirstFrameDelay();
|
||||
};
|
||||
|
|
|
@ -279,5 +279,11 @@ ImageWrapper::GetFrameIndex(uint32_t aWhichFrame)
|
|||
return mInnerImage->GetFrameIndex(aWhichFrame);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(int32_t)
|
||||
ImageWrapper::GetFirstFrameDelay()
|
||||
{
|
||||
return mInnerImage->GetFirstFrameDelay();
|
||||
}
|
||||
|
||||
} // namespace image
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -938,6 +938,21 @@ RasterImage::GetAnimated(bool *aAnimated)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
/* [notxpcom] int32_t getFirstFrameDelay (); */
|
||||
NS_IMETHODIMP_(int32_t)
|
||||
RasterImage::GetFirstFrameDelay()
|
||||
{
|
||||
if (mError)
|
||||
return -1;
|
||||
|
||||
bool animated = false;
|
||||
if (NS_FAILED(GetAnimated(&animated)) || !animated)
|
||||
return -1;
|
||||
|
||||
return mFrames[0]->GetTimeout();
|
||||
}
|
||||
|
||||
nsresult
|
||||
RasterImage::CopyFrame(uint32_t aWhichFrame,
|
||||
uint32_t aFlags,
|
||||
|
|
|
@ -550,6 +550,23 @@ VectorImage::GetAnimated(bool* aAnimated)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
/* [notxpcom] int32_t getFirstFrameDelay (); */
|
||||
int32_t
|
||||
VectorImage::GetFirstFrameDelay()
|
||||
{
|
||||
if (mError)
|
||||
return -1;
|
||||
|
||||
if (!mSVGDocumentWrapper->IsAnimated())
|
||||
return -1;
|
||||
|
||||
// We don't really have a frame delay, so just pretend that we constantly
|
||||
// need updates.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//******************************************************************************
|
||||
/* [notxpcom] boolean frameIsOpaque(in uint32_t aWhichFrame); */
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
Загрузка…
Ссылка в новой задаче