Bug 1176024 - Have TextureClient::Lock check that it can expose a DrawTarget when it makes sense. r=Bas

This commit is contained in:
Nicolas Silva 2015-12-28 10:46:25 +01:00
parent a017483831
commit b77a187126

View File

@ -363,6 +363,15 @@ TextureClient::Lock(OpenMode aMode)
mIsLocked = mData->Lock(aMode, mReleaseFenceHandle.IsValid() ? &mReleaseFenceHandle : nullptr);
mOpenMode = aMode;
if (mIsLocked && CanExposeDrawTarget() && (aMode & OpenMode::OPEN_WRITE) && NS_IsMainThread()) {
if (!BorrowDrawTarget()) {
// Failed to get a DrawTarget, means we won't be able to write into the
// texture, might as well fail now.
Unlock();
return false;
}
}
return mIsLocked;
}