Save the alpha buffer in a member variable.

git-svn-id: svn://10.0.0.236/trunk@7858 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kmcclusk%netscape.com 1998-08-12 19:57:05 +00:00
parent 93e107e40c
commit 5121e1c95d
2 changed files with 33 additions and 4 deletions

View File

@ -106,12 +106,11 @@ nsresult nsImageUnix :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsM
mColorMap = new nsColorMap;
if (mColorMap != nsnull)
{
if (mColorMap != nsnull) {
mColorMap->NumColors = mNumPalleteColors;
mColorMap->Index = new PRUint8[3 * mNumPalleteColors];
memset(mColorMap->Index, 0, sizeof(PRUint8) * (3 * mNumPalleteColors));
}
}
return NS_OK;
}
@ -239,7 +238,28 @@ void nsImageUnix::CompositeImage(nsIImage *aTheImage, nsPoint *aULLocation,nsBle
// lets build an alpha mask from this image
PRBool nsImageUnix::SetAlphaMask(nsIImage *aTheMask)
{
PRInt32 num;
PRUint8 *srcbits;
if (aTheMask &&
(((nsImageUnix*)aTheMask)->mNumBytesPixel == 1)) {
mLocation.x = 0;
mLocation.y = 0;
mAlphaDepth = 8;
mAlphaWidth = aTheMask->GetWidth();
mAlphaHeight = aTheMask->GetWidth();
num = mAlphaWidth*mAlphaHeight;
mARowBytes = aTheMask->GetLineStride();
mAlphaBits = new unsigned char[mARowBytes * mAlphaHeight];
srcbits = aTheMask->GetBits();
memcpy(mAlphaBits,srcbits,num);
return(PR_TRUE);
}
return(PR_FALSE);
}

View File

@ -105,7 +105,6 @@ private:
PRInt32 mOriginalRowBytes;
Pixmap mThePixMap;
PRUint8 *mImageBits;
PRUint8 *mAlphaBits;
PRUint8 *mConvertedBits;
PRBool mConverted;
PRUint8 *mBitsForCreate;
@ -114,6 +113,16 @@ private:
nsColorMap *mColorMap;
PRInt16 mNumPalleteColors;
PRInt8 mNumBytesPixel;
// alpha layer members
PRUint8 *mAlphaBits;
PRInt8 mAlphaDepth; // alpha layer depth
PRInt16 mARowBytes;
PRInt16 mAlphaWidth; // alpha layer width
PRInt16 mAlphaHeight; // alpha layer height
nsPoint mLocation; // alpha mask location
};
#endif