Bug 846132 (Part 3) - Remove imgIContainer::CopyFrame. r=jdm
authorSeth Fowler <seth@mozilla.com>
Tue, 05 Mar 2013 15:39:48 -0800
changeset 134275 c72da9fe616059e09a03dd43132bdb1923823076
parent 134274 a959294f4aa57bf2acb1a853c1918945e080e140
child 134276 a4d2db201d429638c14363425a6771b09125764a
push id2452
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 16:59:38 +0000
treeherdermozilla-beta@d4b152d29d8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs846132
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 846132 (Part 3) - Remove imgIContainer::CopyFrame. r=jdm
image/public/imgIContainer.idl
image/src/RasterImage.cpp
image/src/RasterImage.h
image/src/VectorImage.cpp
--- a/image/public/imgIContainer.idl
+++ b/image/public/imgIContainer.idl
@@ -53,17 +53,17 @@ native nsSize(nsSize);
 /**
  * imgIContainer is the interface that represents an image. It allows
  * access to frames as Thebes surfaces, and permits users to extract subregions
  * as other imgIContainers. It also allows drawing of images on to Thebes
  * contexts.
  *
  * Internally, imgIContainer also manages animation of images.
  */
-[scriptable, builtinclass, uuid(585f4087-5148-478a-862c-5e90cc61413d)]
+[scriptable, builtinclass, uuid(01c4f92f-f883-4837-a127-d8f30920e374)]
 interface imgIContainer : nsISupports
 {
   /**
    * The width of the container rectangle.  In the case of any error,
    * zero is returned, and an exception will be thrown.
    */
   readonly attribute int32_t width;
 
@@ -149,17 +149,19 @@ interface imgIContainer : nsISupports
     * as it is used for ensuring that a valid value was passed in.
     */
   const unsigned long FRAME_FIRST = 0;
   const unsigned long FRAME_CURRENT = 1;
   const unsigned long FRAME_MAX_VALUE = 1;
 
   /**
    * Get a surface for the given frame. This may be a platform-native,
-   * optimized surface, so you cannot inspect its pixel data.
+   * optimized surface, so you cannot inspect its pixel data. If you
+   * need that, use gfxASurface::GetAsReadableARGB32ImageSurface or
+   * gfxASurface::CopyToARGB32ImageSurface.
    *
    * @param aWhichFrame Frame specifier of the FRAME_* variety.
    * @param aFlags Flags of the FLAG_* variety
    */
   [noscript] gfxASurface getFrame(in uint32_t aWhichFrame,
                                   in uint32_t aFlags);
 
   /**
@@ -172,26 +174,16 @@ interface imgIContainer : nsISupports
 
   /**
    * Attempts to create an ImageContainer (and Image) containing the current
    * frame. Only valid for RASTER type images.
    */
   [noscript] ImageContainer getImageContainer(in LayerManager aManager);
 
   /**
-   * Create and return a new copy of the given frame that you can write to
-   * and otherwise inspect the pixels of.
-   *
-   * @param aWhichFrame Frame specifier of the FRAME_* variety.
-   * @param aFlags Flags of the FLAG_* variety
-   */
-  [noscript] gfxImageSurface copyFrame(in uint32_t aWhichFrame,
-                                       in uint32_t aFlags);
-
-  /**
    * Create a new imgContainer that contains only a single frame, which itself
    * contains a subregion of the given frame.
    *
    * @param aWhichFrame Frame specifier of the FRAME_* variety.
    * @param aRect the area of the current frame to be duplicated in the
    *              returned imgContainer's frame.
    * @param aFlags Flags of the FLAG_* variety
    */
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -981,21 +981,17 @@ RasterImage::GetAnimated(bool *aAnimated
     return NS_ERROR_NOT_AVAILABLE;
 
   // We know for sure
   *aAnimated = false;
 
   return NS_OK;
 }
 
-
-//******************************************************************************
-/* [noscript] gfxImageSurface copyFrame(in uint32_t aWhichFrame,
- *                                      in uint32_t aFlags); */
-NS_IMETHODIMP
+nsresult
 RasterImage::CopyFrame(uint32_t aWhichFrame,
                        uint32_t aFlags,
                        gfxImageSurface **_retval)
 {
   if (aWhichFrame > FRAME_MAX_VALUE)
     return NS_ERROR_INVALID_ARG;
 
   if (mError)
--- a/image/src/RasterImage.h
+++ b/image/src/RasterImage.h
@@ -486,16 +486,19 @@ private:
 
   void DrawWithPreDownscaleIfNeeded(imgFrame *aFrame,
                                     gfxContext *aContext,
                                     gfxPattern::GraphicsFilter aFilter,
                                     const gfxMatrix &aUserSpaceToImageSpace,
                                     const gfxRect &aFill,
                                     const nsIntRect &aSubimage);
 
+  nsresult CopyFrame(uint32_t aWhichFrame,
+                     uint32_t aFlags,
+                     gfxImageSurface **_retval);
   /**
    * Advances the animation. Typically, this will advance a single frame, but it
    * may advance multiple frames. This may happen if we have infrequently
    * "ticking" refresh drivers (e.g. in background tabs), or extremely short-
    * lived animation frames.
    *
    * @param aTime the time that the animation should advance to. This will
    *              typically be <= TimeStamp::Now().
--- a/image/src/VectorImage.cpp
+++ b/image/src/VectorImage.cpp
@@ -567,43 +567,16 @@ VectorImage::FrameIsOpaque(uint32_t aWhi
 /* [noscript] gfxASurface getFrame(in uint32_t aWhichFrame,
  *                                 in uint32_t aFlags; */
 NS_IMETHODIMP
 VectorImage::GetFrame(uint32_t aWhichFrame,
                       uint32_t aFlags,
                       gfxASurface** _retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
-  nsRefPtr<gfxImageSurface> surface;
-  nsresult rv = CopyFrame(aWhichFrame, aFlags, getter_AddRefs(surface));
-  if (NS_SUCCEEDED(rv)) {
-    *_retval = surface.forget().get();
-  }
-  return rv;
-}
-
-//******************************************************************************
-/* [noscript] ImageContainer getImageContainer(); */
-NS_IMETHODIMP
-VectorImage::GetImageContainer(LayerManager* aManager,
-                               mozilla::layers::ImageContainer** _retval)
-{
-  *_retval = nullptr;
-  return NS_OK;
-}
-
-//******************************************************************************
-/* [noscript] gfxImageSurface copyFrame(in uint32_t aWhichFrame,
- *                                      in uint32_t aFlags); */
-NS_IMETHODIMP
-VectorImage::CopyFrame(uint32_t aWhichFrame,
-                       uint32_t aFlags,
-                       gfxImageSurface** _retval)
-{
-  NS_ENSURE_ARG_POINTER(_retval);
   // XXXdholbert NOTE: Currently assuming FRAME_CURRENT for simplicity.
   // Could handle FRAME_FIRST by saving helper-doc current time, seeking
   // to time 0, rendering, and then seeking to saved time.
   if (aWhichFrame > FRAME_MAX_VALUE)
     return NS_ERROR_INVALID_ARG;
 
   if (mError)
     return NS_ERROR_FAILURE;
@@ -646,16 +619,26 @@ VectorImage::CopyFrame(uint32_t aWhichFr
   if (NS_SUCCEEDED(rv)) {
     *_retval = surface.forget().get();
   }
 
   return rv;
 }
 
 //******************************************************************************
+/* [noscript] ImageContainer getImageContainer(); */
+NS_IMETHODIMP
+VectorImage::GetImageContainer(LayerManager* aManager,
+                               mozilla::layers::ImageContainer** _retval)
+{
+  *_retval = nullptr;
+  return NS_OK;
+}
+
+//******************************************************************************
 /* [noscript] imgIContainer extractFrame(uint32_t aWhichFrame,
  *                                       [const] in nsIntRect aRegion,
  *                                       in uint32_t aFlags); */
 NS_IMETHODIMP
 VectorImage::ExtractFrame(uint32_t aWhichFrame,
                           const nsIntRect& aRegion,
                           uint32_t aFlags,
                           imgIContainer** _retval)