removing the request attribute from imgIDecoder since it was unused and pointless. r=saari sr=hyatt

This commit is contained in:
pavlov%netscape.com 2001-04-16 09:41:01 +00:00
Родитель dbb8d15bf9
Коммит 1a74015ecf
6 изменённых файлов: 14 добавлений и 69 удалений

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

@ -100,15 +100,7 @@ NS_IMETHODIMP nsGIFDecoder2::Init(imgIRequest *aRequest)
return NS_OK;
}
//******************************************************************************
/* readonly attribute imgIRequest request; */
NS_IMETHODIMP nsGIFDecoder2::GetRequest(imgIRequest * *aRequest)
{
*aRequest = mImageRequest;
NS_IF_ADDREF(*aRequest);
return NS_OK;
}
//******************************************************************************

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

@ -65,12 +65,6 @@ NS_IMETHODIMP nsIconDecoder::Init(imgIRequest *aRequest)
return NS_OK;
}
NS_IMETHODIMP nsIconDecoder::GetRequest(imgIRequest * *aRequest)
{
*aRequest = mRequest;
NS_ADDREF(*aRequest);
return NS_OK;
}
/** nsIOutputStream methods **/

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

@ -161,16 +161,6 @@ NS_IMETHODIMP nsJPEGDecoder::Init(imgIRequest *aRequest)
return NS_OK;
}
/* readonly attribute imgIRequest request; */
NS_IMETHODIMP nsJPEGDecoder::GetRequest(imgIRequest * *aRequest)
{
*aRequest = mRequest;
NS_ADDREF(*aRequest);
return NS_OK;
}
@ -577,7 +567,6 @@ nsJPEGDecoder::OutputScanlines(int num_scanlines)
nsRect r(0, mInfo.output_scanline, mInfo.output_width, 1);
mObserver->OnDataAvailable(nsnull, nsnull, mFrame, &r);
}
return PR_TRUE;

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

@ -104,17 +104,6 @@ NS_IMETHODIMP nsPNGDecoder::Init(imgIRequest *aRequest)
}
/* readonly attribute imgIRequest request; */
NS_IMETHODIMP nsPNGDecoder::GetRequest(imgIRequest * *aRequest)
{
*aRequest = mRequest;
NS_ADDREF(*aRequest);
return NS_OK;
}
/** nsIOutputStream methods **/
@ -153,15 +142,11 @@ static NS_METHOD ReadDataOut(nsIInputStream* in,
// we need to do the setjmp here otherwise bad things will happen
if (setjmp(decoder->mPNG->jmpbuf)) {
png_destroy_read_struct(&decoder->mPNG, &decoder->mInfo, NULL);
// is this NS_ERROR_FAILURE enough?
decoder->mRequest->Cancel(NS_BINDING_ABORTED); // XXX is this the correct error ?
return NS_ERROR_FAILURE;
}
nsresult rv = decoder->ProcessData((unsigned char*)fromRawSegment, count, writeCount);
return rv;
return decoder->ProcessData((unsigned char*)fromRawSegment, count, writeCount);
}
nsresult nsPNGDecoder::ProcessData(unsigned char *data, PRUint32 count, PRUint32 *readCount)
@ -282,8 +267,8 @@ info_callback(png_structp png_ptr, png_infop info_ptr)
/* let libpng expand interlaced images */
if (interlace_type == PNG_INTERLACE_ADAM7) {
/* number_passes = */
png_set_interlace_handling(png_ptr);
/* number_passes = */
png_set_interlace_handling(png_ptr);
}
/* now all of those things we set above are used to update various struct
@ -321,8 +306,8 @@ info_callback(png_structp png_ptr, png_infop info_ptr)
decoder->mObserver->OnStartDecode(nsnull, nsnull);
decoder->mImage = do_CreateInstance("@mozilla.org/image/container;1");
// XXX should we add code to longjmp out of here in failure cases?
// if (!decoder->mImage) return NS_ERROR_OUT_OF_MEMORY;
if (!decoder->mImage)
longjmp(decoder->mPNG->jmpbuf, 5); // NS_ERROR_OUT_OF_MEMORY
decoder->mRequest->SetImage(decoder->mImage);
@ -333,10 +318,8 @@ info_callback(png_structp png_ptr, png_infop info_ptr)
decoder->mObserver->OnStartContainer(nsnull, nsnull, decoder->mImage);
decoder->mFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
#if 0
// XXX should we longjmp to png_ptr->jumpbuf here if we failed?
if (!decoder->mFrame) return NS_ERROR_OUT_OF_MEMORY;
#endif
if (!decoder->mFrame)
longjmp(decoder->mPNG->jmpbuf, 5); // NS_ERROR_OUT_OF_MEMORY
gfx_format format;
@ -374,7 +357,7 @@ info_callback(png_structp png_ptr, png_infop info_ptr)
decoder->interlacebuf = (PRUint8 *)nsMemory::Alloc(channels*width*height);
decoder->ibpr = channels*width;
if (!decoder->interlacebuf) {
// return NS_ERROR_FAILURE;
longjmp(decoder->mPNG->jmpbuf, 5); // NS_ERROR_OUT_OF_MEMORY
}
}
@ -439,11 +422,11 @@ row_callback(png_structp png_ptr, png_bytep new_row,
decoder->mFrame->GetFormat(&format);
PRUint8 *aptr, *cptr;
// The mac specific ifdefs in the code below are there to make sure we
// always fill in 4 byte pixels right now, which is what the mac always
// allocates for its pixel buffers in true color mode. This will change
// when we start storing images with color palettes when they don't need
// true color support (GIFs).
// The mac specific ifdefs in the code below are there to make sure we
// always fill in 4 byte pixels right now, which is what the mac always
// allocates for its pixel buffers in true color mode. This will change
// when we start storing images with color palettes when they don't need
// true color support (GIFs).
switch (format) {
case gfxIFormats::RGB:
case gfxIFormats::BGR:
@ -550,6 +533,5 @@ end_callback(png_structp png_ptr, png_infop info_ptr)
decoder->mObserver->OnStopContainer(nsnull, nsnull, decoder->mImage);
decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
}
}

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

@ -72,15 +72,6 @@ NS_IMETHODIMP nsPPMDecoder::Init(imgIRequest *aRequest)
return NS_OK;
}
/* readonly attribute imgIRequest request; */
NS_IMETHODIMP nsPPMDecoder::GetRequest(imgIRequest * *aRequest)
{
*aRequest = mRequest;
NS_ADDREF(*aRequest);
return NS_OK;
}

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

@ -47,7 +47,4 @@ interface imgIDecoder : nsIOutputStream
* all of the imgIDecoderObserver APIs.
*/
void init(in imgIRequest aRequest);
/// allows access to the nsIImage we have to put bits in to.
readonly attribute imgIRequest request;
};