Bug 993360 - Don't try to lock a texture if it failed to allocate. r=mattwoodrow

This commit is contained in:
Nicolas Silva 2014-04-08 14:50:41 +02:00
parent be16634444
commit aa8364e918

View File

@ -173,6 +173,9 @@ TextureClientD3D11::~TextureClientD3D11()
bool
TextureClientD3D11::Lock(OpenMode aMode)
{
if (!mTexture) {
return false;
}
MOZ_ASSERT(!mIsLocked, "The Texture is already locked!");
LockD3DTexture(mTexture.get());
mIsLocked = true;
@ -190,6 +193,7 @@ void
TextureClientD3D11::Unlock()
{
MOZ_ASSERT(mIsLocked, "Unlocked called while the texture is not locked!");
if (mDrawTarget) {
// see the comment on TextureClientDrawTarget::GetAsDrawTarget.
// This DrawTarget is internal to the TextureClient and is only exposed to the
@ -210,6 +214,10 @@ TextureClientD3D11::GetAsDrawTarget()
{
MOZ_ASSERT(mIsLocked, "Calling TextureClient::GetAsDrawTarget without locking :(");
if (!mTexture) {
return nullptr;
}
if (mDrawTarget) {
return mDrawTarget;
}