fixing bug 106199. r=ben sr=hyatt

This commit is contained in:
pavlov%netscape.com 2001-10-23 08:07:03 +00:00
Родитель b256385db3
Коммит 09e2680121
13 изменённых файлов: 38 добавлений и 274 удалений

Просмотреть файл

@ -34,8 +34,6 @@ NS_IMPL_THREADSAFE_ADDREF(inBitmapDecoder);
NS_IMPL_THREADSAFE_RELEASE(inBitmapDecoder); NS_IMPL_THREADSAFE_RELEASE(inBitmapDecoder);
NS_INTERFACE_MAP_BEGIN(inBitmapDecoder) NS_INTERFACE_MAP_BEGIN(inBitmapDecoder)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIOutputStream)
NS_INTERFACE_MAP_ENTRY(nsIOutputStream)
NS_INTERFACE_MAP_ENTRY(imgIDecoder) NS_INTERFACE_MAP_ENTRY(imgIDecoder)
NS_INTERFACE_MAP_END_THREADSAFE NS_INTERFACE_MAP_END_THREADSAFE
@ -84,11 +82,6 @@ NS_IMETHODIMP inBitmapDecoder::Flush()
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
NS_IMETHODIMP inBitmapDecoder::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval) NS_IMETHODIMP inBitmapDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval)
{ {
nsresult rv; nsresult rv;
@ -147,28 +140,3 @@ NS_IMETHODIMP inBitmapDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count,
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP inBitmapDecoder::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP inBitmapDecoder::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -1,51 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*/
#ifndef __inBitmapDecoder_h__
#define __inBitmapDecoder_h__
#include "imgIDecoder.h"
#include "nsCOMPtr.h"
#include "imgIContainer.h"
#include "imgIDecoderObserver.h"
#include "gfxIImageFrame.h"
#include "imgILoad.h"
class inBitmapDecoder : public imgIDecoder
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
inBitmapDecoder();
virtual ~inBitmapDecoder();
private:
nsCOMPtr<imgIContainer> mImage;
nsCOMPtr<gfxIImageFrame> mFrame;
nsCOMPtr<imgIDecoderObserver> mObserver; // this is just qi'd from mRequest for speed
};
#endif // __inBitmapDecoder_h__

Просмотреть файл

@ -37,7 +37,7 @@
// GIF Decoder Implementation // GIF Decoder Implementation
// This is an adaptor between GIF2 and imgIDecoder // This is an adaptor between GIF2 and imgIDecoder
NS_IMPL_ISUPPORTS2(nsGIFDecoder2, imgIDecoder, nsIOutputStream); NS_IMPL_ISUPPORTS1(nsGIFDecoder2, imgIDecoder);
nsGIFDecoder2::nsGIFDecoder2() nsGIFDecoder2::nsGIFDecoder2()
{ {
@ -136,13 +136,6 @@ NS_IMETHODIMP nsGIFDecoder2::Flush()
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
//******************************************************************************
/* unsigned long write (in string buf, in unsigned long count); */
NS_IMETHODIMP nsGIFDecoder2::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//****************************************************************************** //******************************************************************************
/* static callback from nsIInputStream::ReadSegments */ /* static callback from nsIInputStream::ReadSegments */
static NS_METHOD ReadDataOut(nsIInputStream* in, static NS_METHOD ReadDataOut(nsIInputStream* in,
@ -230,39 +223,6 @@ NS_IMETHODIMP nsGIFDecoder2::WriteFrom(nsIInputStream *inStr, PRUint32 count, PR
return NS_OK; return NS_OK;
} }
//******************************************************************************
/* [noscript] unsigned long writeSegments (in nsReadSegmentFun reader, in voidPtr closure, in unsigned long count); */
NS_IMETHODIMP nsGIFDecoder2::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* attribute boolean nonBlocking; */
NS_IMETHODIMP nsGIFDecoder2::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
NS_IMETHODIMP nsGIFDecoder2::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* attribute nsIOutputStreamObserver observer; */
NS_IMETHODIMP nsGIFDecoder2::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
NS_IMETHODIMP nsGIFDecoder2::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//****************************************************************************** //******************************************************************************
// GIF decoder callback methods. Part of pulic API for GIF2 // GIF decoder callback methods. Part of pulic API for GIF2

Просмотреть файл

@ -48,7 +48,6 @@ class nsGIFDecoder2 : public imgIDecoder
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
nsGIFDecoder2(); nsGIFDecoder2();
virtual ~nsGIFDecoder2(); virtual ~nsGIFDecoder2();

Просмотреть файл

@ -24,22 +24,16 @@
#include "nsJPEGDecoder.h" #include "nsJPEGDecoder.h"
#include "imgIContainerObserver.h"
#include "nsIComponentManager.h"
#include "nsIInputStream.h" #include "nsIInputStream.h"
#include "nspr.h" #include "nspr.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "nsIComponentManager.h"
#include "imgIContainerObserver.h"
#include "ImageLogging.h" #include "ImageLogging.h"
NS_IMPL_ISUPPORTS1(nsJPEGDecoder, imgIDecoder)
NS_IMPL_ISUPPORTS2(nsJPEGDecoder, imgIDecoder, nsIOutputStream)
#if defined(PR_LOGGING) #if defined(PR_LOGGING)
PRLogModuleInfo *gJPEGlog = PR_NewLogModule("JPEGDecoder"); PRLogModuleInfo *gJPEGlog = PR_NewLogModule("JPEGDecoder");
@ -48,7 +42,6 @@ PRLogModuleInfo *gJPEGlog = PR_NewLogModule("JPEGDecoder");
#endif #endif
static void PR_CALLBACK init_source (j_decompress_ptr jd); static void PR_CALLBACK init_source (j_decompress_ptr jd);
static boolean PR_CALLBACK fill_input_buffer (j_decompress_ptr jd); static boolean PR_CALLBACK fill_input_buffer (j_decompress_ptr jd);
static void PR_CALLBACK skip_input_data (j_decompress_ptr jd, long num_bytes); static void PR_CALLBACK skip_input_data (j_decompress_ptr jd, long num_bytes);
@ -163,10 +156,6 @@ NS_IMETHODIMP nsJPEGDecoder::Init(imgILoad *aLoad)
} }
/** nsIOutputStream methods **/
/* void close (); */ /* void close (); */
NS_IMETHODIMP nsJPEGDecoder::Close() NS_IMETHODIMP nsJPEGDecoder::Close()
{ {
@ -198,12 +187,6 @@ NS_IMETHODIMP nsJPEGDecoder::Flush()
return NS_OK; return NS_OK;
} }
/* unsigned long write (in string buf, in unsigned long count); */
NS_IMETHODIMP nsJPEGDecoder::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long writeFrom (in nsIInputStream inStr, in unsigned long count); */ /* unsigned long writeFrom (in nsIInputStream inStr, in unsigned long count); */
NS_IMETHODIMP nsJPEGDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval) NS_IMETHODIMP nsJPEGDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval)
{ {
@ -580,36 +563,6 @@ nsJPEGDecoder::OutputScanlines(int num_scanlines)
} }
/* [noscript] unsigned long writeSegments (in nsReadSegmentFun reader, in voidPtr closure, in unsigned long count); */
NS_IMETHODIMP nsJPEGDecoder::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean nonBlocking; */
NS_IMETHODIMP nsJPEGDecoder::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsJPEGDecoder::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsIOutputStreamObserver observer; */
NS_IMETHODIMP nsJPEGDecoder::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsJPEGDecoder::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* Override the standard error method in the IJG JPEG decoder code. */ /* Override the standard error method in the IJG JPEG decoder code. */
void PR_CALLBACK void PR_CALLBACK
my_error_exit (j_common_ptr cinfo) my_error_exit (j_common_ptr cinfo)

Просмотреть файл

@ -72,7 +72,6 @@ class nsJPEGDecoder : public imgIDecoder
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
nsJPEGDecoder(); nsJPEGDecoder();
virtual ~nsJPEGDecoder(); virtual ~nsJPEGDecoder();

Просмотреть файл

@ -40,7 +40,7 @@ PR_STATIC_CALLBACK(void) row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass); png_uint_32 row_num, int pass);
PR_STATIC_CALLBACK(void) end_callback(png_structp png_ptr, png_infop info_ptr); PR_STATIC_CALLBACK(void) end_callback(png_structp png_ptr, png_infop info_ptr);
NS_IMPL_ISUPPORTS2(nsPNGDecoder, imgIDecoder, nsIOutputStream) NS_IMPL_ISUPPORTS1(nsPNGDecoder, imgIDecoder)
nsPNGDecoder::nsPNGDecoder() nsPNGDecoder::nsPNGDecoder()
{ {
@ -97,11 +97,6 @@ NS_IMETHODIMP nsPNGDecoder::Init(imgILoad *aLoad)
return NS_OK; return NS_OK;
} }
/** nsIOutputStream methods **/
/* void close (); */ /* void close (); */
NS_IMETHODIMP nsPNGDecoder::Close() NS_IMETHODIMP nsPNGDecoder::Close()
{ {
@ -117,12 +112,6 @@ NS_IMETHODIMP nsPNGDecoder::Flush()
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
/* unsigned long write (in string buf, in unsigned long count); */
NS_IMETHODIMP nsPNGDecoder::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
static NS_METHOD ReadDataOut(nsIInputStream* in, static NS_METHOD ReadDataOut(nsIInputStream* in,
void* closure, void* closure,
@ -157,41 +146,6 @@ NS_IMETHODIMP nsPNGDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRU
return inStr->ReadSegments(ReadDataOut, this, count, _retval); return inStr->ReadSegments(ReadDataOut, this, count, _retval);
} }
/* [noscript] unsigned long writeSegments (in nsReadSegmentFun reader, in voidPtr closure, in unsigned long count); */
NS_IMETHODIMP nsPNGDecoder::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean nonBlocking; */
NS_IMETHODIMP nsPNGDecoder::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsPNGDecoder::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsIOutputStreamObserver observer; */
NS_IMETHODIMP nsPNGDecoder::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsPNGDecoder::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void void
info_callback(png_structp png_ptr, png_infop info_ptr) info_callback(png_structp png_ptr, png_infop info_ptr)

Просмотреть файл

@ -49,7 +49,6 @@ class nsPNGDecoder : public imgIDecoder
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
nsPNGDecoder(); nsPNGDecoder();
virtual ~nsPNGDecoder(); virtual ~nsPNGDecoder();

Просмотреть файл

@ -34,7 +34,7 @@
#include "nsRect.h" #include "nsRect.h"
NS_IMPL_ISUPPORTS2(nsPPMDecoder, imgIDecoder, nsIOutputStream) NS_IMPL_ISUPPORTS1(nsPPMDecoder, imgIDecoder)
nsPPMDecoder::nsPPMDecoder() nsPPMDecoder::nsPPMDecoder()
@ -72,12 +72,6 @@ NS_IMETHODIMP nsPPMDecoder::Init(imgILoad *aLoad)
return NS_OK; return NS_OK;
} }
/** nsIOutputStream methods **/
/* void close (); */ /* void close (); */
NS_IMETHODIMP nsPPMDecoder::Close() NS_IMETHODIMP nsPPMDecoder::Close()
{ {
@ -96,12 +90,6 @@ NS_IMETHODIMP nsPPMDecoder::Flush()
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
/* unsigned long write (in string buf, in unsigned long count); */
NS_IMETHODIMP nsPPMDecoder::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
static char *__itoa(int n) static char *__itoa(int n)
{ {
char *s; char *s;
@ -268,30 +256,3 @@ NS_IMETHODIMP nsPPMDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRU
return NS_OK; return NS_OK;
} }
/* [noscript] unsigned long writeSegments (in nsReadSegmentFun reader, in voidPtr closure, in unsigned long count); */
NS_IMETHODIMP nsPPMDecoder::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean nonBlocking; */
NS_IMETHODIMP nsPPMDecoder::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsPPMDecoder::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsIOutputStreamObserver observer; */
NS_IMETHODIMP nsPPMDecoder::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsPPMDecoder::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -46,7 +46,6 @@ class nsPPMDecoder : public imgIDecoder
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
nsPPMDecoder(); nsPPMDecoder();
virtual ~nsPPMDecoder(); virtual ~nsPPMDecoder();

Просмотреть файл

@ -22,19 +22,19 @@
*/ */
#include "nsISupports.idl" #include "nsISupports.idl"
#include "nsIOutputStream.idl"
interface nsIInputStream;
interface imgILoad; interface imgILoad;
/** /**
* imgIDecoder interface * imgIDecoder interface
* *
* @author Stuart Parmenter <pavlov@netscape.com> * @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1 * @version 0.2
* @see imagelib2 * @see imagelib2
*/ */
[scriptable, uuid(9eebf43a-1dd1-11b2-953e-f1782f4cbad3)] [scriptable, uuid(9eebf43a-1dd1-11b2-953e-f1782f4cbad3)]
interface imgIDecoder : nsIOutputStream interface imgIDecoder : nsISupports
{ {
/** /**
* Initalize an image decoder. * Initalize an image decoder.
@ -46,4 +46,31 @@ interface imgIDecoder : nsIOutputStream
* all of the imgIDecoderObserver APIs. * all of the imgIDecoderObserver APIs.
*/ */
void init(in imgILoad aLoad); void init(in imgILoad aLoad);
/**
* Closes the stream.
*/
void close();
/**
* Flushes the stream.
*/
void flush();
/**
* Writes data into the stream from an input stream.
* Implementer's note: This method is defined by this interface in order
* to allow the output stream to efficiently copy the data from the input
* stream into its internal buffer (if any). If this method was provide
* as an external facility, a separate char* buffer would need to be used
* in order to call the output stream's other Write method.
* @param fromStream the stream from which the data is read
* @param count the maximun number of bytes to write
* @return aWriteCount out parameter to hold the number of
* bytes written. if an error occurs, the writecount
* is undefined
*/
unsigned long writeFrom(in nsIInputStream inStr,
in unsigned long count);
}; };

Просмотреть файл

@ -43,7 +43,7 @@ interface imgIRequest : nsIRequest
* @return the image object associated with the request. * @return the image object associated with the request.
* @attention NEED DOCS * @attention NEED DOCS
*/ */
attribute imgIContainer image; readonly attribute imgIContainer image;
/** /**
* Bits set in the return value from imageStatus * Bits set in the return value from imageStatus

Просмотреть файл

@ -219,10 +219,6 @@ NS_IMETHODIMP imgRequestProxy::GetImage(imgIContainer * *aImage)
mOwner->GetImage(aImage); mOwner->GetImage(aImage);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP imgRequestProxy::SetImage(imgIContainer *aImage)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long imageStatus; */ /* readonly attribute unsigned long imageStatus; */
NS_IMETHODIMP imgRequestProxy::GetImageStatus(PRUint32 *aStatus) NS_IMETHODIMP imgRequestProxy::GetImageStatus(PRUint32 *aStatus)