Bug 1224979. Check if we compute usable filters for the downscaler, and if not put the downscaler in error state so it's not used. r=edwin

This commit is contained in:
Timothy Nikkel 2016-01-28 17:30:01 -06:00
parent 3b1d48a397
commit cf078d87e6

View File

@ -106,11 +106,21 @@ Downscaler::BeginFrame(const nsIntSize& aOriginalSize,
0, mTargetSize.width,
mXFilter.get());
if (mXFilter->max_filter() <= 0 || mXFilter->num_values() != mTargetSize.width) {
NS_WARNING("Failed to compute filters for image downscaling");
return NS_ERROR_OUT_OF_MEMORY;
}
skia::resize::ComputeFilters(resizeMethod,
mOriginalSize.height, mTargetSize.height,
0, mTargetSize.height,
mYFilter.get());
if (mYFilter->max_filter() <= 0 || mYFilter->num_values() != mTargetSize.height) {
NS_WARNING("Failed to compute filters for image downscaling");
return NS_ERROR_OUT_OF_MEMORY;
}
// Allocate the buffer, which contains scanlines of the original image.
// pad by 15 to handle overreads by the simd code
size_t bufferLen = mOriginalSize.width * sizeof(uint32_t) + 15;