Bug 601928: Check result of create texture for tmpTexture. r=jrmuizel a=blocking-beta8

This commit is contained in:
Bas Schouten 2010-10-08 18:02:53 +02:00
Родитель 0bfe8f0d3d
Коммит 4489f5b64c
3 изменённых файлов: 25 добавлений и 3 удалений

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

@ -256,6 +256,17 @@ LayerManagerD3D9::CreateOptimalSurface(const gfxIntSize &aSize,
#endif
}
void
LayerManagerD3D9::ReportFailure(const nsACString &aMsg, HRESULT aCode)
{
// We could choose to abort here when hr == E_OUTOFMEMORY.
nsCString msg;
msg.Append(aMsg);
msg.AppendLiteral(" Error code: ");
msg.AppendInt(aCode);
NS_WARNING(msg.BeginReading());
}
void
LayerManagerD3D9::Render()
{

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

@ -189,6 +189,8 @@ public:
virtual const char* Name() const { return "D3D9"; }
#endif // MOZ_LAYERS_HAVE_LOG
void ReportFailure(const nsACString &aMsg, HRESULT aCode);
private:
/* Default device manager instance */
static DeviceManagerD3D9 *mDefaultDeviceManager;
@ -260,6 +262,10 @@ public:
/* Called by the layer manager when it's destroyed */
virtual void LayerManagerDestroyed() {}
void ReportFailure(const nsACString &aMsg, HRESULT aCode) {
return mD3DManager->ReportFailure(aMsg, aCode);
}
protected:
LayerManagerD3D9 *mD3DManager;
};

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

@ -361,9 +361,14 @@ ThebesLayerD3D9::DrawRegion(const nsIntRegion &aRegion)
nsRefPtr<gfxASurface> destinationSurface;
nsRefPtr<IDirect3DTexture9> tmpTexture;
device()->CreateTexture(bounds.width, bounds.height, 1,
0, fmt,
D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), NULL);
hr = device()->CreateTexture(bounds.width, bounds.height, 1,
0, fmt,
D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), NULL);
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("Failed to create temporary texture in system memory."), hr);
return;
}
nsRefPtr<IDirect3DSurface9> surf;
HDC dc;