Issue #2546 - Part 4: Remove mappedDataLength and findOptimalFormat

This commit is contained in:
Moonchild 2024-07-09 11:56:51 +02:00 committed by roytam1
commit b1e5955ceb
5 changed files with 0 additions and 70 deletions

View file

@ -1561,43 +1561,5 @@ ImageBitmap::ExtensionsEnabled(JSContext* aCx, JSObject*)
}
}
// ImageBitmap extensions.
ImageBitmapFormat
ImageBitmap::FindOptimalFormat(const Optional<Sequence<ImageBitmapFormat>>& aPossibleFormats,
ErrorResult& aRv)
{
MOZ_ASSERT(mDataWrapper, "No ImageBitmapFormatUtils functionalities.");
ImageBitmapFormat platformFormat = mDataWrapper->GetFormat();
if (!aPossibleFormats.WasPassed() ||
aPossibleFormats.Value().Contains(platformFormat)) {
return platformFormat;
} else {
// If no matching is found, FindBestMatchingFromat() returns
// ImageBitmapFormat::EndGuard_ and we throw an exception.
ImageBitmapFormat optimalFormat =
FindBestMatchingFromat(platformFormat, aPossibleFormats.Value());
if (optimalFormat == ImageBitmapFormat::EndGuard_) {
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
return optimalFormat;
}
}
int32_t
ImageBitmap::MappedDataLength(ImageBitmapFormat aFormat, ErrorResult& aRv)
{
MOZ_ASSERT(mDataWrapper, "No ImageBitmapFormatUtils functionalities.");
if (aFormat == mDataWrapper->GetFormat()) {
return mDataWrapper->GetBufferLength();
} else {
return CalculateImageBufferSize(aFormat, Width(), Height());
}
}
} // namespace dom
} // namespace mozilla