bool CompositableHost::AddMaskEffect(EffectChain& aEffects, const gfx::Matrix4x4& aTransform, bool aIs3D) { RefPtr<TextureSource> source; RefPtr<DeprecatedTextureHost> oldHost = GetDeprecatedTextureHost(); if (oldHost && oldHost->Lock()) { source = oldHost; } else { RefPtr<TextureHost> host = GetAsTextureHost(); if (host && host->Lock()) { source = host->GetTextureSources(); } } if (!source) { NS_WARNING("Using compositable with no texture host as mask layer"); return false; } RefPtr<EffectMask> effect = new EffectMask(source, source->GetSize(), aTransform); effect->mIs3D = aIs3D; aEffects.mSecondaryEffects[EFFECT_MASK] = effect; return true; }
bool CompositableHost::AddMaskEffect(EffectChain& aEffects, const gfx::Matrix4x4& aTransform, bool aIs3D) { CompositableTextureSourceRef source; RefPtr<TextureHost> host = GetAsTextureHost(); if (!host) { NS_WARNING("Using compositable with no valid TextureHost as mask"); return false; } if (!host->Lock()) { NS_WARNING("Failed to lock the mask texture"); return false; } if (!host->BindTextureSource(source)) { NS_WARNING("The TextureHost was successfully locked but can't provide a TextureSource"); host->Unlock(); return false; } MOZ_ASSERT(source); RefPtr<EffectMask> effect = new EffectMask(source, source->GetSize(), aTransform); effect->mIs3D = aIs3D; aEffects.mSecondaryEffects[EffectTypes::MASK] = effect; return true; }
void CompositableHost::RemoveMaskEffect() { RefPtr<TextureHost> host = GetAsTextureHost(); if (host) { host->Unlock(); } }
void CompositableHost::RemoveMaskEffect() { RefPtr<DeprecatedTextureHost> oldHost = GetDeprecatedTextureHost(); if (oldHost) { oldHost->Unlock(); } else { RefPtr<TextureHost> host = GetAsTextureHost(); if (host) { host->Unlock(); } } }