Bug 214191 - crash printing pages with spacer images.

r=roland.mainz, sr=bzbarsky
This commit is contained in:
tor%cs.brown.edu 2003-07-28 21:23:24 +00:00
Родитель 272e86c75d
Коммит 872af3604a
2 изменённых файлов: 34 добавлений и 4 удалений

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

@ -2573,6 +2573,16 @@ PRInt32 sRow, eRow, rStep;
if(bytes_Per_Pix == 1)
return ;
aImage->LockImagePixels(PR_FALSE);
theBits = aImage->GetBits();
/* image data might not be available (ex: spacer image) */
if (!theBits)
{
aImage->UnlockImagePixels(PR_FALSE);
return;
}
rowData = aImage->GetLineStride();
height = aImage->GetHeight();
width = aImage->GetWidth();
@ -2591,8 +2601,6 @@ PRInt32 sRow, eRow, rStep;
fprintf(f, " { currentfile rowdata readhexstring pop }\n");
fprintf(f, " image\n");
aImage->LockImagePixels(PR_FALSE);
theBits = aImage->GetBits();
n = 0;
if ( ( isTopToBottom = aImage->GetIsRowOrderTopToBottom()) == PR_TRUE ) {
sRow = height - 1;
@ -2658,6 +2666,16 @@ PRInt32 sRow, eRow, rStep;
if(bytes_Per_Pix == 1)
return ;
aImage->LockImagePixels(PR_FALSE);
theBits = aImage->GetBits();
/* image data might not be available (ex: spacer image) */
if (!theBits)
{
aImage->UnlockImagePixels(PR_FALSE);
return;
}
rowData = aImage->GetLineStride();
height = aImage->GetHeight();
width = aImage->GetWidth();
@ -2676,8 +2694,6 @@ PRInt32 sRow, eRow, rStep;
fprintf(f, " { currentfile rowdata readhexstring pop }\n");
fprintf(f, " false 3 colorimage\n");
aImage->LockImagePixels(PR_FALSE);
theBits = aImage->GetBits();
n = 0;
if ( ( isTopToBottom = aImage->GetIsRowOrderTopToBottom()) == PR_TRUE ) {
sRow = height - 1;

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

@ -1061,6 +1061,13 @@ nsXPrintContext::DrawImageBitsScaled(xGC *xgc, nsIImage *aImage,
PRInt32 aSrcHeight = aImage->GetHeight();
PRUint8 *composed_bits = nsnull;
/* image data might not be available (ex: spacer image) */
if (!image_bits)
{
aImage->UnlockImagePixels(PR_FALSE);
return NS_OK;
}
// Use client-side alpha image composing - plain X11 can only do 1bit alpha
// stuff - this method adds 8bit alpha support, too...
if( alphaBits != nsnull )
@ -1139,6 +1146,13 @@ nsXPrintContext::DrawImage(xGC *xgc, nsIImage *aImage,
PRUint8 *image_bits = aImage->GetBits();
PRUint8 *composed_bits = nsnull;
PRInt32 row_bytes = aImage->GetLineStride();
/* image data might not be available (ex: spacer image) */
if (!image_bits)
{
aImage->UnlockImagePixels(PR_FALSE);
return NS_OK;
}
// Use client-side alpha image composing - plain X11 can only do 1bit alpha
// stuff - this method adds 8bit alpha support, too...