Bug 1897745 - Check for null surface in ScaleDataSourceSurface. r=aosmond

Every use of ScaleDataSourceSurface checks for a null result and just spits out
a warning. So here it seems reasonable to check the input is valid, and if not,
just spit out that null result. This should give us more consistent behavior
between debug and opt builds.

Differential Revision: https://phabricator.services.mozilla.com/D212501
This commit is contained in:
Lee Salzman
2024-06-04 02:41:30 +00:00
parent c71bc839d0
commit e4a8b84667

View File

@@ -288,7 +288,9 @@ static already_AddRefed<DataSourceSurface> CropAndCopyDataSourceSurface(
*/
static already_AddRefed<DataSourceSurface> ScaleDataSourceSurface(
DataSourceSurface* aSurface, const ImageBitmapOptions& aOptions) {
MOZ_ASSERT(aSurface);
if (NS_WARN_IF(!aSurface)) {
return nullptr;
}
const SurfaceFormat format = aSurface->GetFormat();
const int bytesPerPixel = BytesPerPixel(format);