mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1019000 - Ensure that successfully write-locked D3D TextureClients provide a valid DrawTarget. r=mattwoodrow
This commit is contained in:
parent
53c7044efa
commit
1a0d677506
@ -100,14 +100,16 @@ DataTextureSourceD3D11::~DataTextureSourceD3D11()
|
||||
|
||||
|
||||
template<typename T> // ID3D10Texture2D or ID3D11Texture2D
|
||||
static void LockD3DTexture(T* aTexture)
|
||||
static bool LockD3DTexture(T* aTexture)
|
||||
{
|
||||
MOZ_ASSERT(aTexture);
|
||||
RefPtr<IDXGIKeyedMutex> mutex;
|
||||
aTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));
|
||||
if (mutex) {
|
||||
mutex->AcquireSync(0, INFINITE);
|
||||
if (!mutex) {
|
||||
return false;
|
||||
}
|
||||
mutex->AcquireSync(0, INFINITE);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T> // ID3D10Texture2D or ID3D11Texture2D
|
||||
@ -180,8 +182,21 @@ TextureClientD3D11::Lock(OpenMode aMode)
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(!mIsLocked, "The Texture is already locked!");
|
||||
LockD3DTexture(mTexture.get());
|
||||
mIsLocked = true;
|
||||
|
||||
mIsLocked = LockD3DTexture(mTexture.get());
|
||||
if (!mIsLocked) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure that successful write-lock means we will have a DrawTarget to
|
||||
// write into.
|
||||
if (aMode & OpenMode::OPEN_WRITE) {
|
||||
mDrawTarget = BorrowDrawTarget();
|
||||
if (!mDrawTarget) {
|
||||
Unlock();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mNeedsClear) {
|
||||
mDrawTarget = BorrowDrawTarget();
|
||||
@ -230,6 +245,7 @@ TextureClientD3D11::BorrowDrawTarget()
|
||||
return mDrawTarget;
|
||||
}
|
||||
|
||||
// This may return a null DrawTarget
|
||||
mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, mFormat);
|
||||
return mDrawTarget;
|
||||
}
|
||||
@ -324,10 +340,9 @@ DXGITextureHostD3D11::Lock()
|
||||
mSize = IntSize(desc.Width, desc.Height);
|
||||
}
|
||||
|
||||
LockD3DTexture(mTextureSource->GetD3D11Texture());
|
||||
mIsLocked = LockD3DTexture(mTextureSource->GetD3D11Texture());
|
||||
|
||||
mIsLocked = true;
|
||||
return true;
|
||||
return mIsLocked;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -563,7 +563,7 @@ CairoTextureClientD3D9::~CairoTextureClientD3D9()
|
||||
}
|
||||
|
||||
bool
|
||||
CairoTextureClientD3D9::Lock(OpenMode)
|
||||
CairoTextureClientD3D9::Lock(OpenMode aMode)
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
if (!IsValid() || !IsAllocated()) {
|
||||
@ -587,6 +587,16 @@ CairoTextureClientD3D9::Lock(OpenMode)
|
||||
|
||||
mIsLocked = true;
|
||||
|
||||
// Make sure that successful write-lock means we will have a DrawTarget to
|
||||
// write into.
|
||||
if (aMode & OpenMode::OPEN_WRITE) {
|
||||
mDrawTarget = BorrowDrawTarget();
|
||||
if (!mDrawTarget) {
|
||||
Unlock();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mNeedsClear) {
|
||||
mDrawTarget = BorrowDrawTarget();
|
||||
mDrawTarget->ClearRect(Rect(0, 0, GetSize().width, GetSize().height));
|
||||
|
Loading…
Reference in New Issue
Block a user