mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-28 19:38:13 +00:00
Bug 897452 - Part 0.2 - Make sure the texture host has a compositor - r=mattwoodrow
This commit is contained in:
parent
1f2be47e2a
commit
bf82b9d838
@ -46,6 +46,16 @@ CompositableHost::~CompositableHost()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CompositableHost::UseTextureHost(TextureHost* aTexture)
|
||||
{
|
||||
if (!aTexture) {
|
||||
return;
|
||||
}
|
||||
aTexture->SetCompositor(GetCompositor());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CompositableHost::AddTextureHost(TextureHost* aTexture)
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ public:
|
||||
virtual void PrintInfo(nsACString& aTo, const char* aPrefix) { }
|
||||
|
||||
void AddTextureHost(TextureHost* aTexture);
|
||||
virtual void UseTextureHost(TextureHost* aTexture) {}
|
||||
virtual void UseTextureHost(TextureHost* aTexture);
|
||||
// If a texture host is flagged for deferred removal, the compositable will
|
||||
// get an option to run any cleanup code early, that is when it would have
|
||||
// been run if the texture host was not marked deferred.
|
||||
|
@ -38,6 +38,7 @@ ImageHost::~ImageHost() {}
|
||||
void
|
||||
ImageHost::UseTextureHost(TextureHost* aTexture)
|
||||
{
|
||||
CompositableHost::UseTextureHost(aTexture);
|
||||
mFrontBuffer = aTexture;
|
||||
}
|
||||
|
||||
@ -74,6 +75,10 @@ ImageHost::Composite(EffectChain& aEffectChain,
|
||||
if (!mFrontBuffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the front buffer has a compositor
|
||||
mFrontBuffer->SetCompositor(GetCompositor());
|
||||
|
||||
if (!mFrontBuffer->Lock()) {
|
||||
NS_WARNING("failed to lock front buffer");
|
||||
return;
|
||||
|
@ -384,6 +384,13 @@ BufferTextureHost::MaybeUpload(nsIntRegion *aRegion)
|
||||
bool
|
||||
BufferTextureHost::Upload(nsIntRegion *aRegion)
|
||||
{
|
||||
if (!mCompositor) {
|
||||
NS_WARNING("Tried to upload without a compositor. Skipping texture upload...");
|
||||
// If we are in this situation it means we should have called SetCompositor
|
||||
// earlier. It is conceivable that on certain rare conditions with async-video
|
||||
// we may end up here for the first frame, but this should not happen repeatedly.
|
||||
return false;
|
||||
}
|
||||
if (mFormat == gfx::FORMAT_UNKNOWN) {
|
||||
NS_WARNING("BufferTextureHost: unsupported format!");
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user