diff --git a/mozilla/gfx/src/motif/nsImageUnix.cpp b/mozilla/gfx/src/motif/nsImageUnix.cpp index bf25f825d5e..e9fa141f86d 100644 --- a/mozilla/gfx/src/motif/nsImageUnix.cpp +++ b/mozilla/gfx/src/motif/nsImageUnix.cpp @@ -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); + } diff --git a/mozilla/gfx/src/motif/nsImageUnix.h b/mozilla/gfx/src/motif/nsImageUnix.h index 73dbbd13f03..400cb22922f 100644 --- a/mozilla/gfx/src/motif/nsImageUnix.h +++ b/mozilla/gfx/src/motif/nsImageUnix.h @@ -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