Fixed the background with Transparent PNG's and a 32 and 16 bit depth printing problem.

r=kmmclusk sr=buster bug = 55093, 46871
This commit is contained in:
dcone%netscape.com 2000-12-12 21:27:42 +00:00
Родитель 224fc4ade8
Коммит 3e1ced8554
1 изменённых файлов: 11 добавлений и 5 удалений

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

@ -749,7 +749,7 @@ HBITMAP maskBits,tileBits,oldBits,oldMaskBits;
((nsDrawingSurfaceWin *)aSurface)->GetTECHNOLOGY(&canRaster); ((nsDrawingSurfaceWin *)aSurface)->GetTECHNOLOGY(&canRaster);
// we have to use the old way.. for 256 color mode and printing.. slow, but will always work. // we have to use the old way.. for 256 color mode and printing.. slow, but will always work.
if ((canRaster==DT_RASPRINTER) || (256==mNumPaletteColors) || (aWidth>MAX_BUFFER_WIDTH) || (aHeight>MAX_BUFFER_HEIGHT)){ if ((mAlphaDepth>1) || (canRaster==DT_RASPRINTER) || (256==mNumPaletteColors) || (aWidth>MAX_BUFFER_WIDTH) || (aHeight>MAX_BUFFER_HEIGHT)){
for(y=aY0;y<aY1;y+=aHeight){ for(y=aY0;y<aY1;y+=aHeight){
for(x=aX0;x<aX1;x+=aWidth){ for(x=aX0;x<aX1;x+=aWidth){
this->Draw(aContext,aSurface,x,y,aWidth,aHeight); this->Draw(aContext,aSurface,x,y,aWidth,aHeight);
@ -1106,7 +1106,9 @@ UINT palType;
numbytes = ::GetObject(mHBitmap,sizeof(BITMAP),&srcinfo); numbytes = ::GetObject(mHBitmap,sizeof(BITMAP),&srcinfo);
// put into a DIB if (nsnull != mBHead){
delete[] mBHead;
}
BuildDIB(&mBHead,mBHead->biWidth,mBHead->biHeight,srcinfo.bmBitsPixel,&mNumBytesPixel); BuildDIB(&mBHead,mBHead->biWidth,mBHead->biHeight,srcinfo.bmBitsPixel,&mNumBytesPixel);
mRowBytes = CalcBytesSpan(mBHead->biWidth); mRowBytes = CalcBytesSpan(mBHead->biWidth);
mSizeImage = mRowBytes * mBHead->biHeight; // no compression mSizeImage = mRowBytes * mBHead->biHeight; // no compression
@ -1143,11 +1145,15 @@ PRInt16 numPaletteColors;
if (8 == aDepth) { if (8 == aDepth) {
numPaletteColors = 256; numPaletteColors = 256;
*aNumBytesPix = 1; *aNumBytesPix = 1;
} else if (16 == aDepth) {
numPaletteColors = 0;
*aNumBytesPix = 2;
} else if (24 == aDepth) { } else if (24 == aDepth) {
numPaletteColors = 0; numPaletteColors = 0;
*aNumBytesPix = 3; *aNumBytesPix = 3;
} else if (16 == aDepth) { } else if (32 == aDepth) {
*aNumBytesPix = 2; numPaletteColors = 0;
*aNumBytesPix = 4;
} else { } else {
NS_ASSERTION(PR_FALSE, "unexpected image depth"); NS_ASSERTION(PR_FALSE, "unexpected image depth");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;