Bug 284978: Create DDB surface. If failed, try DIB. r=ere, sr=bz

This commit is contained in:
paper%animecity.nu 2005-03-07 02:35:47 +00:00
Родитель d222975881
Коммит fa6dd84904
1 изменённых файлов: 16 добавлений и 14 удалений

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

@ -431,11 +431,15 @@ NS_IMETHODIMP nsDrawingSurfaceWin :: Init(HDC aDC, PRUint32 aWidth,
if (nsnull == mSurface)
#endif
{
HBITMAP tbits;
HBITMAP tbits = nsnull;
if (aWidth > 0 && aHeight > 0)
{
if (aFlags & NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS)
if ((aFlags & NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS) == 0)
tbits = ::CreateCompatibleBitmap(aDC, aWidth, aHeight);
// Create a DIB if we need Pixel Access, or if DDB creation failed
if (nsnull == tbits)
{
void *bits;
BITMAPINFO *binfo;
@ -449,21 +453,19 @@ NS_IMETHODIMP nsDrawingSurfaceWin :: Init(HDC aDC, PRUint32 aWidth,
binfo = CreateBitmapInfo(aWidth, aHeight, depth);
if (nsnull != binfo)
mSelectedBitmap = tbits = ::CreateDIBSection(aDC, binfo, DIB_RGB_COLORS, &bits, NULL, 0);
if (nsnull == binfo)
return NS_ERROR_FAILURE;
mSelectedBitmap = tbits = ::CreateDIBSection(aDC, binfo, DIB_RGB_COLORS, &bits, NULL, 0);
if (NULL == mSelectedBitmap)
tbits = ::CreateCompatibleBitmap(aDC, aWidth, aHeight);
else
{
mBitmapInfo = binfo;
mDIBits = (PRUint8 *)bits;
mBitmap.bmWidthBytes = RASWIDTH(aWidth, depth);
mBitmap.bmBitsPixel = depth;
}
return NS_ERROR_FAILURE;
mBitmapInfo = binfo;
mDIBits = (PRUint8 *)bits;
mBitmap.bmWidthBytes = RASWIDTH(aWidth, depth);
mBitmap.bmBitsPixel = depth;
}
else
tbits = ::CreateCompatibleBitmap(aDC, aWidth, aHeight);
}
else
{