зеркало из https://github.com/mozilla/gecko-dev.git
Bug 900133 - Support MaskLayers that are backed by a NewTextureHost. r=nical
--HG-- extra : rebase_source : 8494dd32a837fc1ca44ed7c838e4def84f3292e1
This commit is contained in:
Родитель
341fd56ab3
Коммит
98941e95cf
|
@ -93,6 +93,8 @@ CanvasLayerComposite::RenderLayer(const nsIntPoint& aOffset,
|
|||
gfx::Point(aOffset.x, aOffset.y),
|
||||
gfx::ToFilter(filter),
|
||||
clipRect);
|
||||
|
||||
LayerManagerComposite::RemoveMaskEffect(mMaskLayer);
|
||||
}
|
||||
|
||||
CompositableHost*
|
||||
|
|
|
@ -40,6 +40,7 @@ ColorLayerComposite::RenderLayer(const nsIntPoint& aOffset,
|
|||
rect, clipRect,
|
||||
transform, gfx::Point(aOffset.x, aOffset.y));
|
||||
|
||||
LayerManagerComposite::RemoveMaskEffect(GetMaskLayer());
|
||||
}
|
||||
|
||||
} /* layers */
|
||||
|
|
|
@ -104,7 +104,18 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects,
|
|||
const gfx::Matrix4x4& aTransform,
|
||||
bool aIs3D)
|
||||
{
|
||||
RefPtr<TextureSource> source = GetDeprecatedTextureHost();
|
||||
RefPtr<TextureSource> source;
|
||||
RefPtr<DeprecatedTextureHost> oldHost = GetDeprecatedTextureHost();
|
||||
if (oldHost) {
|
||||
oldHost->Lock();
|
||||
source = oldHost;
|
||||
} else {
|
||||
RefPtr<TextureHost> host = GetTextureHost();
|
||||
if (host) {
|
||||
host->Lock();
|
||||
source = host->GetTextureSources();
|
||||
}
|
||||
}
|
||||
|
||||
if (!source) {
|
||||
NS_WARNING("Using compositable with no texture host as mask layer");
|
||||
|
@ -119,6 +130,20 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects,
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CompositableHost::RemoveMaskEffect()
|
||||
{
|
||||
RefPtr<DeprecatedTextureHost> oldHost = GetDeprecatedTextureHost();
|
||||
if (oldHost) {
|
||||
oldHost->Unlock();
|
||||
} else {
|
||||
RefPtr<TextureHost> host = GetTextureHost();
|
||||
if (host) {
|
||||
host->Unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ TemporaryRef<CompositableHost>
|
||||
CompositableHost::Create(const TextureInfo& aTextureInfo)
|
||||
{
|
||||
|
|
|
@ -172,6 +172,8 @@ public:
|
|||
const gfx::Matrix4x4& aTransform,
|
||||
bool aIs3D = false);
|
||||
|
||||
void RemoveMaskEffect();
|
||||
|
||||
Compositor* GetCompositor() const
|
||||
{
|
||||
return mCompositor;
|
||||
|
|
|
@ -163,6 +163,8 @@ ContainerRender(ContainerT* aContainer,
|
|||
rect, clipRect,
|
||||
transform, gfx::Point(aOffset.x, aOffset.y));
|
||||
}
|
||||
|
||||
LayerManagerComposite::RemoveMaskEffect(aContainer->GetMaskLayer());
|
||||
}
|
||||
|
||||
ContainerLayerComposite::ContainerLayerComposite(LayerManagerComposite *aManager)
|
||||
|
|
|
@ -96,6 +96,8 @@ ImageLayerComposite::RenderLayer(const nsIntPoint& aOffset,
|
|||
gfx::Point(aOffset.x, aOffset.y),
|
||||
gfx::ToFilter(mFilter),
|
||||
clipRect);
|
||||
|
||||
LayerManagerComposite::RemoveMaskEffect(mMaskLayer);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -661,6 +661,21 @@ LayerManagerComposite::AddMaskEffect(Layer* aMaskLayer, EffectChain& aEffects, b
|
|||
return maskLayerComposite->GetCompositableHost()->AddMaskEffect(aEffects, transform, aIs3D);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
LayerManagerComposite::RemoveMaskEffect(Layer* aMaskLayer)
|
||||
{
|
||||
if (!aMaskLayer) {
|
||||
return;
|
||||
}
|
||||
LayerComposite* maskLayerComposite = static_cast<LayerComposite*>(aMaskLayer->ImplData());
|
||||
if (!maskLayerComposite->GetCompositableHost()) {
|
||||
NS_WARNING("Mask layer with no compositable host");
|
||||
return;
|
||||
}
|
||||
|
||||
maskLayerComposite->GetCompositableHost()->RemoveMaskEffect();
|
||||
}
|
||||
|
||||
TemporaryRef<DrawTarget>
|
||||
LayerManagerComposite::CreateDrawTarget(const IntSize &aSize,
|
||||
SurfaceFormat aFormat)
|
||||
|
|
|
@ -165,6 +165,8 @@ public:
|
|||
EffectChain& aEffect,
|
||||
bool aIs3D = false);
|
||||
|
||||
static void RemoveMaskEffect(Layer* aMaskLayer);
|
||||
|
||||
/**
|
||||
* Creates a DrawTarget which is optimized for inter-operating with this
|
||||
* layermanager.
|
||||
|
|
|
@ -140,6 +140,7 @@ ThebesLayerComposite::RenderLayer(const nsIntPoint& aOffset,
|
|||
mValidRegion = tiledLayerProps.mValidRegion;
|
||||
}
|
||||
|
||||
LayerManagerComposite::RemoveMaskEffect(mMaskLayer);
|
||||
mCompositeManager->GetCompositor()->MakeCurrent();
|
||||
}
|
||||
|
||||
|
|
|
@ -462,9 +462,6 @@ TextureImageDeprecatedTextureHostOGL::Lock()
|
|||
return false;
|
||||
}
|
||||
|
||||
NS_ASSERTION(mTexture->GetContentType() != gfxASurface::CONTENT_ALPHA,
|
||||
"Image layer has alpha image");
|
||||
|
||||
mFormat = mTexture->GetTextureFormat();
|
||||
|
||||
return true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче