зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1163878 (Part 1) - Add an IsImageContainerAvailable method to imgIContainer. r=tn
This commit is contained in:
Родитель
01891337d7
Коммит
d57e957cee
|
@ -116,7 +116,7 @@ native nsIntSizeByVal(nsIntSize);
|
|||
*
|
||||
* Internally, imgIContainer also manages animation of images.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(e3261ae7-4749-4cf6-bf06-59946233366f)]
|
||||
[scriptable, builtinclass, uuid(f5e1230a-3733-477f-b49b-fee8717a786b)]
|
||||
interface imgIContainer : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -269,9 +269,18 @@ interface imgIContainer : nsISupports
|
|||
*/
|
||||
[notxpcom] boolean isOpaque();
|
||||
|
||||
/**
|
||||
* @return true if getImageContainer() is expected to return a valid
|
||||
* ImageContainer when passed the given @Manager and @Flags
|
||||
* parameters.
|
||||
*/
|
||||
[noscript, notxpcom] boolean isImageContainerAvailable(in LayerManager aManager,
|
||||
in uint32_t aFlags);
|
||||
/**
|
||||
* Attempts to create an ImageContainer (and Image) containing the current
|
||||
* frame. Only valid for RASTER type images.
|
||||
* frame.
|
||||
*
|
||||
* Avoid calling this unless you're actually going to layerize this image.
|
||||
*
|
||||
* @param aManager The LayerManager which will be used to create the
|
||||
* ImageContainer.
|
||||
|
|
|
@ -268,6 +268,15 @@ ClippedImage::GetFrameInternal(const nsIntSize& aSize,
|
|||
return mCachedSurface->Surface();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
ClippedImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
if (!ShouldClip()) {
|
||||
return InnerImage()->IsImageContainerAvailable(aManager, aFlags);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
|
||||
ClippedImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
|
@ -281,7 +290,7 @@ ClippedImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
|
|||
return InnerImage()->GetImageContainer(aManager, aFlags);
|
||||
}
|
||||
|
||||
return (nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -37,6 +37,8 @@ public:
|
|||
NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) override;
|
||||
NS_IMETHOD_(TemporaryRef<SourceSurface>)
|
||||
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
|
||||
NS_IMETHOD_(bool) IsImageContainerAvailable(layers::LayerManager* aManager,
|
||||
uint32_t aFlags) override;
|
||||
NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)
|
||||
GetImageContainer(layers::LayerManager* aManager,
|
||||
uint32_t aFlags) override;
|
||||
|
|
|
@ -194,6 +194,12 @@ DynamicImage::IsOpaque()
|
|||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
DynamicImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
|
||||
DynamicImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
|
|
|
@ -44,6 +44,12 @@ FrozenImage::GetFrame(uint32_t aWhichFrame,
|
|||
return InnerImage()->GetFrame(FRAME_FIRST, aFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
FrozenImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
|
||||
FrozenImage::GetImageContainer(layers::LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,8 @@ public:
|
|||
NS_IMETHOD GetAnimated(bool* aAnimated) override;
|
||||
NS_IMETHOD_(TemporaryRef<SourceSurface>)
|
||||
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
|
||||
NS_IMETHOD_(bool) IsImageContainerAvailable(layers::LayerManager* aManager,
|
||||
uint32_t aFlags) override;
|
||||
NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)
|
||||
GetImageContainer(layers::LayerManager* aManager,
|
||||
uint32_t aFlags) override;
|
||||
|
|
|
@ -180,6 +180,12 @@ ImageWrapper::IsOpaque()
|
|||
return mInnerImage->IsOpaque();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
ImageWrapper::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
return mInnerImage->IsImageContainerAvailable(aManager, aFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
|
||||
ImageWrapper::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
|
|
|
@ -122,6 +122,15 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
|
|||
return target->Snapshot();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
OrientedImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
if (mOrientation.IsIdentity()) {
|
||||
return InnerImage()->IsImageContainerAvailable(aManager, aFlags);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
|
||||
OrientedImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,8 @@ public:
|
|||
NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) override;
|
||||
NS_IMETHOD_(TemporaryRef<SourceSurface>)
|
||||
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
|
||||
NS_IMETHOD_(bool) IsImageContainerAvailable(layers::LayerManager* aManager,
|
||||
uint32_t aFlags) override;
|
||||
NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)
|
||||
GetImageContainer(layers::LayerManager* aManager,
|
||||
uint32_t aFlags) override;
|
||||
|
|
|
@ -805,6 +805,18 @@ RasterImage::GetCurrentImage(ImageContainer* aContainer, uint32_t aFlags)
|
|||
return MakePair(result.first(), Move(image));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
RasterImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
int32_t maxTextureSize = aManager->GetMaxTextureSize();
|
||||
if (!mHasSize ||
|
||||
mSize.width > maxTextureSize ||
|
||||
mSize.height > maxTextureSize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
|
||||
RasterImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
|
||||
|
|
|
@ -712,6 +712,12 @@ VectorImage::GetFrame(uint32_t aWhichFrame,
|
|||
return result == DrawResult::SUCCESS ? dt->Snapshot() : nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
VectorImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
/* [noscript] ImageContainer getImageContainer(); */
|
||||
NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
|
||||
|
|
Загрузка…
Ссылка в новой задаче