Bug 1101248: Properly check return values of creation functions in DrawTargetD2D1::Init. r=BenWa

This commit is contained in:
Bas Schouten 2014-11-24 19:44:48 +00:00
parent c0b02a0607
commit 08dbb53c8c

View File

@ -816,17 +816,22 @@ DrawTargetD2D1::Init(const IntSize &aSize, SurfaceFormat aFormat)
props.pixelFormat = D2DPixelFormat(aFormat);
props.colorContext = nullptr;
props.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET;
mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mBitmap));
hr = mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mBitmap));
if (FAILED(hr)) {
gfxWarning() << *this << ": Error " << hexa(hr) << " failed to create new CommandList.";
gfxCriticalError() << *this << ": Error " << hexa(hr) << " failed to create new Bitmap. Size: " << aSize;
return false;
}
props.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
props.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mTempBitmap));
hr = mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mTempBitmap));
if (FAILED(hr)) {
gfxCriticalError() << *this << ": Error " << hexa(hr) << " failed to create new TempBitmap. Size: " << aSize;
return false;
}
mDC->SetTarget(mBitmap);