Bug 1500733 - Remove ImageBitmap.mappedDataLength, r=aosmond
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 23 Oct 2018 23:35:44 +0200
changeset 490926 17ac83c08f67ff1e3846c375de8d5dd0851580b3
parent 490925 3c81d4cb6aea693144608f2f78eb4b893b2687f3
child 490927 e324b60281ddc58a514dc84db048431a64312a01
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersaosmond
bugs1500733
milestone65.0a1
Bug 1500733 - Remove ImageBitmap.mappedDataLength, r=aosmond
dom/canvas/ImageBitmap.cpp
dom/canvas/ImageBitmap.h
dom/canvas/ImageBitmapUtils.cpp
dom/canvas/ImageBitmapUtils.h
dom/webidl/ImageBitmap.webidl
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -1544,31 +1544,16 @@ ImageBitmap::FindOptimalFormat(const Opt
     if (optimalFormat == ImageBitmapFormat::EndGuard_) {
       aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
     }
 
     return optimalFormat;
   }
 }
 
-int32_t
-ImageBitmap::MappedDataLength(ImageBitmapFormat aFormat, ErrorResult& aRv)
-{
-  if (!mDataWrapper) {
-    aRv.Throw(NS_ERROR_NOT_AVAILABLE);
-    return 0;
-  }
-
-  if (aFormat == mDataWrapper->GetFormat()) {
-    return mDataWrapper->GetBufferLength();
-  } else {
-    return CalculateImageBufferSize(aFormat, Width(), Height());
-  }
-}
-
 size_t
 ImageBitmap::GetAllocatedSize() const
 {
   if (!mAllocatedImageData) {
     return 0;
   }
 
   // Calculate how many bytes are used.
--- a/dom/canvas/ImageBitmap.h
+++ b/dom/canvas/ImageBitmap.h
@@ -148,19 +148,16 @@ public:
   friend CreateImageBitmapFromBlobTask;
   friend CreateImageBitmapFromBlobWorkerTask;
 
   // Mozilla Extensions
   ImageBitmapFormat
   FindOptimalFormat(const Optional<Sequence<ImageBitmapFormat>>& aPossibleFormats,
                     ErrorResult& aRv);
 
-  int32_t
-  MappedDataLength(ImageBitmapFormat aFormat, ErrorResult& aRv);
-
   size_t GetAllocatedSize() const;
 
   void OnShutdown();
 
 protected:
 
   /*
    * The default value of aIsPremultipliedAlpha is TRUE because that the
--- a/dom/canvas/ImageBitmapUtils.cpp
+++ b/dom/canvas/ImageBitmapUtils.cpp
@@ -2725,26 +2725,16 @@ uint8_t
 GetChannelCountOfImageFormat(ImageBitmapFormat aFormat)
 {
   UtilsUniquePtr format = Utils::GetUtils(aFormat);
   MOZ_ASSERT(format, "Cannot get a valid ImageBitmapFormatUtils instance.");
 
   return format->GetChannelCount();
 }
 
-uint32_t
-CalculateImageBufferSize(ImageBitmapFormat aFormat,
-                         uint32_t aWidth, uint32_t aHeight)
-{
-  UtilsUniquePtr format = Utils::GetUtils(aFormat);
-  MOZ_ASSERT(format, "Cannot get a valid ImageBitmapFormatUtils instance.");
-
-  return format->NeededBufferSize(aWidth, aHeight);
-}
-
 UniquePtr<ImagePixelLayout>
 CopyAndConvertImageData(ImageBitmapFormat aSrcFormat,
                         const uint8_t* aSrcBuffer,
                         const ImagePixelLayout* aSrcLayout,
                         ImageBitmapFormat aDstFormat,
                         uint8_t* aDstBuffer)
 {
   MOZ_ASSERT(aSrcBuffer, "Convert color from a null buffer.");
--- a/dom/canvas/ImageBitmapUtils.h
+++ b/dom/canvas/ImageBitmapUtils.h
@@ -44,24 +44,16 @@ CreatePixelLayoutFromPlanarYCbCrData(con
 
 /*
  * Get the number of channels of the given ImageBitmapFormat.
  */
 uint8_t
 GetChannelCountOfImageFormat(ImageBitmapFormat aFormat);
 
 /*
- * Get the needed buffer size to store the image data in the given
- * ImageBitmapFormat with the given width and height.
- */
-uint32_t
-CalculateImageBufferSize(ImageBitmapFormat aFormat,
-                         uint32_t aWidth, uint32_t aHeight);
-
-/*
  * This function always copies the image data in _aSrcBuffer_ into _aDstBuffer_
  * and it also performs color conversion if the _aSrcFormat_ and the
  * _aDstFormat_ are different.
  *
  * The source image is stored in the _aSrcBuffer_ and the corresponding pixel
  * layout is described by the _aSrcLayout_.
  *
  * The copied and converted image will be stored in the _aDstBuffer_, which
--- a/dom/webidl/ImageBitmap.webidl
+++ b/dom/webidl/ImageBitmap.webidl
@@ -392,11 +392,9 @@ dictionary ChannelPixelLayout {
     required unsigned long              skip;
 };
 
 typedef sequence<ChannelPixelLayout> ImagePixelLayout;
 
 partial interface ImageBitmap {
     [Throws, Func="mozilla::dom::DOMPrefs::canvas_imagebitmap_extensions_enabled"]
     ImageBitmapFormat               findOptimalFormat (optional sequence<ImageBitmapFormat> aPossibleFormats);
-    [Throws, Func="mozilla::dom::DOMPrefs::canvas_imagebitmap_extensions_enabled"]
-    long                            mappedDataLength (ImageBitmapFormat aFormat);
 };