Bug 1368776 - Part 10. Implement RasterImage::IsImageContainerAvailableAtSize and GetImageContainerAtSize. r=tnikkel

This commit is contained in:
Andrew Osmond 2017-11-17 06:45:26 -05:00
Родитель d6a6987766
Коммит a594e125e0
1 изменённых файлов: 14 добавлений и 10 удалений

Просмотреть файл

@ -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<ImageContainer>)
@ -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<ImageContainer>)
@ -652,7 +656,7 @@ RasterImage::GetImageContainerAtSize(LayerManager* aManager,
const IntSize& aSize,
uint32_t aFlags)
{
return nullptr;
return GetImageContainerImpl(aManager, aSize, aFlags);
}
size_t