зеркало из https://github.com/mozilla/gecko-dev.git
Bug 284978: Create DDB surface. If failed, try DIB. r=ere, sr=bz
This commit is contained in:
Родитель
d222975881
Коммит
fa6dd84904
|
@ -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
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче