mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 809273 - Add AutoLockTextureHost and use it to avoid needing to manually unlock. r=nrc
This commit is contained in:
parent
6a644b8e27
commit
cec7cf3964
@ -46,7 +46,9 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
|
||||
{
|
||||
NS_ASSERTION(aVisibleRegion, "Requires a visible region");
|
||||
|
||||
if (!mTextureHost || !mTextureHost->Lock()) {
|
||||
AutoLockTextureHost lock(mTextureHost);
|
||||
|
||||
if (!mTextureHost || !lock->IsValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,7 +83,6 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
|
||||
subregion.And(region, textureRect);
|
||||
if (subregion.IsEmpty()) {
|
||||
// Region is empty, nothing to draw
|
||||
mTextureHost->Unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -182,8 +183,6 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
|
||||
if (iterOnWhite) {
|
||||
iterOnWhite->EndTileIteration();
|
||||
}
|
||||
|
||||
mTextureHost->Unlock();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -296,6 +296,31 @@ protected:
|
||||
ISurfaceAllocator* mDeAllocator;
|
||||
};
|
||||
|
||||
class AutoLockTextureHost
|
||||
{
|
||||
public:
|
||||
AutoLockTextureHost(TextureHost* aHost)
|
||||
: mTextureHost(aHost)
|
||||
, mIsValid(true)
|
||||
{
|
||||
if (mTextureHost) {
|
||||
mIsValid = mTextureHost->Lock();
|
||||
}
|
||||
}
|
||||
|
||||
~AutoLockTextureHost()
|
||||
{
|
||||
if (mTextureHost && mIsValid) {
|
||||
mTextureHost->Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
bool IsValid() { return mIsValid; }
|
||||
|
||||
private:
|
||||
TextureHost *mTextureHost;
|
||||
bool mIsValid;
|
||||
};
|
||||
|
||||
/**
|
||||
* This can be used as an offscreen rendering target by the compositor, and
|
||||
|
Loading…
Reference in New Issue
Block a user