diff --git a/image/RasterImage.cpp b/image/RasterImage.cpp index 27eebe1b4c80..b2219e2a82d6 100644 --- a/image/RasterImage.cpp +++ b/image/RasterImage.cpp @@ -623,14 +623,7 @@ RasterImage::GetFrameInternal(const IntSize& aSize, 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; + return IsImageContainerAvailableAtSize(aManager, mSize, aFlags); } NS_IMETHODIMP_(already_AddRefed) @@ -644,7 +637,18 @@ RasterImage::IsImageContainerAvailableAtSize(LayerManager* aManager, const IntSize& aSize, uint32_t aFlags) { - return false; + // We check the minimum size because while we support downscaling, we do not + // support upscaling. If aSize > mSize, we will never give a larger surface + // than mSize. If mSize > aSize, and mSize > maxTextureSize, we still want to + // use image containers if aSize <= maxTextureSize. + int32_t maxTextureSize = aManager->GetMaxTextureSize(); + if (!mHasSize || aSize.IsEmpty() || + min(mSize.width, aSize.width) > maxTextureSize || + min(mSize.height, aSize.height) > maxTextureSize) { + return false; + } + + return true; } NS_IMETHODIMP_(already_AddRefed) @@ -652,7 +656,7 @@ RasterImage::GetImageContainerAtSize(LayerManager* aManager, const IntSize& aSize, uint32_t aFlags) { - return nullptr; + return GetImageContainerImpl(aManager, aSize, aFlags); } size_t