Bug 418871 - Remove unused parts from imgIContainer.idl. r=joe, sr=vlad
authorAlfred Kayser <alfredkayser@gmail.com>
Sun, 05 Apr 2009 16:52:18 +0200
changeset 26936 66bc0f3cdb844e5025ac6f3f3fdfa36e90e8791e
parent 26935 905b72e27bb9e837b4115a5671588a7087a5913a
child 26938 425bccd5fc7c8e54e27c863e5131987caf0d5367
push idunknown
push userunknown
push dateunknown
reviewersjoe, vlad
bugs418871
milestone1.9.2a1pre
Bug 418871 - Remove unused parts from imgIContainer.idl. r=joe, sr=vlad
modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp
modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp
modules/libpr0n/decoders/png/nsPNGDecoder.cpp
modules/libpr0n/public/imgIContainer.idl
modules/libpr0n/src/imgContainer.cpp
--- a/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp
+++ b/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp
@@ -408,17 +408,17 @@ void nsGIFDecoder2::EndImageFrame()
 
     // We actually have the timeout information before we get the lzw encoded 
     // image data, at least according to the spec, but we delay in setting the 
     // timeout for the image until here to help ensure that we have the whole 
     // image frame decoded before we go off and try to display another frame.
     mImageFrame->SetTimeout(mGIFStruct.delay_time);
     if (mGIFStruct.images_decoded)
       mImageContainer->AppendFrame(mImageFrame);
-    mImageContainer->EndFrameDecode(mGIFStruct.images_decoded, mGIFStruct.delay_time);
+    mImageContainer->EndFrameDecode(mGIFStruct.images_decoded);
     mGIFStruct.images_decoded++; 
 
     if (mObserver)
       mObserver->OnStopFrame(nsnull, mImageFrame);
   }
 
   // Release reference to this frame
   mImageFrame = nsnull;
--- a/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp
+++ b/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp
@@ -474,32 +474,29 @@ nsresult nsJPEGDecoder::ProcessData(cons
     }
 
     mImage->Init(mInfo.image_width, mInfo.image_height, mObserver);
 
     mObserver->OnStartContainer(nsnull, mImage);
 
     mImage->GetFrameAt(0, getter_AddRefs(mFrame));
 
-    PRBool createNewFrame = PR_TRUE;
-
     if (mFrame) {
       PRInt32 width, height;
       mFrame->GetWidth(&width);
       mFrame->GetHeight(&height);
 
-      if ((width == (PRInt32)mInfo.image_width) &&
-          (height == (PRInt32)mInfo.image_height)) {
-        createNewFrame = PR_FALSE;
-      } else {
-        mImage->Clear();
+      if ((width != (PRInt32)mInfo.image_width) ||
+          (height != (PRInt32)mInfo.image_height)) {
+        // Can't reuse frame, create a new one with correct size
+        mFrame = nsnull;
       }
     }
 
-    if (createNewFrame) {
+    if (!mFrame) {
       mFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
       if (!mFrame) {
         mState = JPEG_ERROR;
         PR_LOG(gJPEGDecoderAccountingLog, PR_LOG_DEBUG,
                ("} (could not create image frame)"));
         return NS_ERROR_OUT_OF_MEMORY;
       }
 
--- a/modules/libpr0n/decoders/png/nsPNGDecoder.cpp
+++ b/modules/libpr0n/decoders/png/nsPNGDecoder.cpp
@@ -191,17 +191,17 @@ void nsPNGDecoder::EndImageFrame()
     nsCOMPtr<nsIImage> img(do_GetInterface(mFrame));
     if (NS_FAILED(img->ImageUpdated(nsnull, nsImageUpdateFlags_kBitsChanged, &r))) {
       mError = PR_TRUE;
       // allow the call out to the observers.
     }
     mObserver->OnDataAvailable(nsnull, mFrame, &r);
   }
 
-  mImage->EndFrameDecode(numFrames, timeout);
+  mImage->EndFrameDecode(numFrames);
   if (mObserver)
     mObserver->OnStopFrame(nsnull, mFrame);
 }
 
 
 /** imgIDecoder methods **/
 
 /* void init (in imgILoad aLoad); */
--- a/modules/libpr0n/public/imgIContainer.idl
+++ b/modules/libpr0n/public/imgIContainer.idl
@@ -44,20 +44,20 @@
 
 interface gfxIImageFrame;
 interface imgIContainerObserver;
 
 /**
  * gfxIImageContainer interface
  *
  * @author Stuart Parmenter <pavlov@netscape.com>
- * @version 0.1
+ * @version 0.2
  * @see "gfx2"
  */
-[scriptable, uuid(186e80e1-476c-47f0-b340-424e6b7b6c9c)]
+[scriptable, uuid(a4e9df32-f5d7-479f-9082-70e1fead23d5)]
 interface imgIContainer : nsISupports
 {
   /** 
    * "Disposal" method indicates how the image should be handled before the
    *  subsequent image is displayed.
    *  Don't change these without looking at the implementations using them,
    *  struct gif_struct::disposal_method and gif_write() in particular.
    */
@@ -129,26 +129,22 @@ interface imgIContainer : nsISupports
   gfxIImageFrame getFrameAt(in unsigned long index);
 
   /**
    * Adds \a item to the end of the list of frames.
    * @param item frame to add.
    */
   void appendFrame(in gfxIImageFrame item);
 
-  void removeFrame(in gfxIImageFrame item);
-
   /* notification when the current frame is done decoding */
-  void endFrameDecode(in unsigned long framenumber, in unsigned long timeout);
+  void endFrameDecode(in unsigned long framenumber);
   
   /* notification that the entire image has been decoded */
   void decodingComplete();
   
-  void clear();
-
   void startAnimation();
 
   void stopAnimation();
 
   void resetAnimation();
 
   /**
    * number of times to loop the image.
--- a/modules/libpr0n/src/imgContainer.cpp
+++ b/modules/libpr0n/src/imgContainer.cpp
@@ -270,26 +270,18 @@ NS_IMETHODIMP imgContainer::AppendFrame(
   // because StartAnimation checks for > 1 frames
   if (mFrames.Count() == 2)
     StartAnimation();
   
   return NS_OK;
 }
 
 //******************************************************************************
-/* void removeFrame (in gfxIImageFrame item); */
-NS_IMETHODIMP imgContainer::RemoveFrame(gfxIImageFrame *item)
-{
-  /* Remember to decrement mNumFrames if you implement this */
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-//******************************************************************************
-/* void endFrameDecode (in unsigned long framenumber, in unsigned long timeout); */
-NS_IMETHODIMP imgContainer::EndFrameDecode(PRUint32 aFrameNum, PRUint32 aTimeout)
+/* void endFrameDecode (in unsigned long framenumber); */
+NS_IMETHODIMP imgContainer::EndFrameDecode(PRUint32 aFrameNum)
 {
   // Assume there's another frame.
   // currentDecodingFrameIndex is 0 based, aFrameNum is 1 based
   if (mAnim)
     mAnim->currentDecodingFrameIndex = aFrameNum;
   
   return NS_OK;
 }
@@ -303,23 +295,16 @@ NS_IMETHODIMP imgContainer::DecodingComp
   // If there's only 1 frame, optimize it.
   // Optimizing animated images is not supported
   if (mNumFrames == 1)
     mFrames[0]->SetMutable(PR_FALSE);
   return NS_OK;
 }
 
 //******************************************************************************
-/* void clear (); */
-NS_IMETHODIMP imgContainer::Clear()
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-//******************************************************************************
 /* attribute unsigned short animationMode; */
 NS_IMETHODIMP imgContainer::GetAnimationMode(PRUint16 *aAnimationMode)
 {
   NS_ENSURE_ARG_POINTER(aAnimationMode);
   
   *aAnimationMode = mAnimationMode;
   return NS_OK;
 }