Fixed Init() to compute the mask row size correctly

This commit is contained in:
troy%netscape.com 1998-07-16 22:18:36 +00:00
Родитель 8a146ed86e
Коммит f98b66a3df
1 изменённых файлов: 8 добавлений и 5 удалений

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

@ -79,22 +79,25 @@ nsresult nsImageWin :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsMa
if (aMaskRequirements != nsMaskRequirements_kNoMask)
{
PRInt32 sizeMask;
if (nsMaskRequirements_kNeeds1Bit == aMaskRequirements)
{
sizeMask = (aWidth + 7) / 8 * aHeight;
mARowBytes = (aWidth + 7) / 8;
mAlphaDepth = 1;
}
else
{
NS_ASSERTION(nsMaskRequirements_kNeeds8Bit == aMaskRequirements,
"unexpected mask depth");
sizeMask = aWidth * aHeight;
mARowBytes = aWidth;
mAlphaDepth = 8;
}
// 32-bit align each row
mARowBytes = (mARowBytes + 3) & ~0x3;
mAlphaBits = new unsigned char[mARowBytes * aHeight];
mAlphaWidth = aWidth;
mAlphaWidth = aHeight;
mAlphaBits = new unsigned char[sizeMask];
}
else
{