mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Don't hardcode ContentHostTexture in PaintedLayerMLGPU. (bug 1420674 part 1, r=rhunt)
This commit is contained in:
parent
6c3abcde6a
commit
af51bf9ed7
@ -46,6 +46,7 @@ class ThebesBufferData;
|
|||||||
class TiledContentHost;
|
class TiledContentHost;
|
||||||
class CompositableParentManager;
|
class CompositableParentManager;
|
||||||
class WebRenderImageHost;
|
class WebRenderImageHost;
|
||||||
|
class ContentHost;
|
||||||
class ContentHostTexture;
|
class ContentHostTexture;
|
||||||
struct EffectChain;
|
struct EffectChain;
|
||||||
|
|
||||||
@ -149,6 +150,7 @@ public:
|
|||||||
Layer* GetLayer() const { return mLayer; }
|
Layer* GetLayer() const { return mLayer; }
|
||||||
void SetLayer(Layer* aLayer) { mLayer = aLayer; }
|
void SetLayer(Layer* aLayer) { mLayer = aLayer; }
|
||||||
|
|
||||||
|
virtual ContentHost* AsContentHost() { return nullptr; }
|
||||||
virtual ContentHostTexture* AsContentHostTexture() { return nullptr; }
|
virtual ContentHostTexture* AsContentHostTexture() { return nullptr; }
|
||||||
virtual ImageHost* AsImageHost() { return nullptr; }
|
virtual ImageHost* AsImageHost() { return nullptr; }
|
||||||
virtual TiledContentHost* AsTiledContentHost() { return nullptr; }
|
virtual TiledContentHost* AsTiledContentHost() { return nullptr; }
|
||||||
|
@ -68,6 +68,7 @@ public:
|
|||||||
MOZ_ASSERT_UNREACHABLE("Must be implemented in derived class");
|
MOZ_ASSERT_UNREACHABLE("Must be implemented in derived class");
|
||||||
return gfx::IntRect();
|
return gfx::IntRect();
|
||||||
}
|
}
|
||||||
|
virtual ContentHost* AsContentHost() { return this; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit ContentHost(const TextureInfo& aTextureInfo)
|
explicit ContentHost(const TextureInfo& aTextureInfo)
|
||||||
|
@ -36,11 +36,17 @@ PaintedLayerMLGPU::OnPrepareToRender(FrameBuilder* aBuilder)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mTexture = mHost->AcquireTextureSource();
|
ContentHostTexture* single = mHost->AsContentHostTexture();
|
||||||
|
if (!single) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mTexture = single->AcquireTextureSource();
|
||||||
if (!mTexture) {
|
if (!mTexture) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mTextureOnWhite = mHost->AcquireTextureSourceOnWhite();
|
mTextureOnWhite = single->AcquireTextureSourceOnWhite();
|
||||||
|
mDestOrigin = single->GetOriginOffset();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,9 +83,10 @@ bool
|
|||||||
PaintedLayerMLGPU::SetCompositableHost(CompositableHost* aHost)
|
PaintedLayerMLGPU::SetCompositableHost(CompositableHost* aHost)
|
||||||
{
|
{
|
||||||
switch (aHost->GetType()) {
|
switch (aHost->GetType()) {
|
||||||
|
case CompositableType::CONTENT_TILED:
|
||||||
case CompositableType::CONTENT_SINGLE:
|
case CompositableType::CONTENT_SINGLE:
|
||||||
case CompositableType::CONTENT_DOUBLE:
|
case CompositableType::CONTENT_DOUBLE:
|
||||||
mHost = static_cast<ContentHostBase*>(aHost)->AsContentHostTexture();
|
mHost = aHost->AsContentHost();
|
||||||
if (!mHost) {
|
if (!mHost) {
|
||||||
gfxWarning() << "ContentHostBase is not a ContentHostTexture";
|
gfxWarning() << "ContentHostBase is not a ContentHostTexture";
|
||||||
}
|
}
|
||||||
@ -95,6 +102,12 @@ PaintedLayerMLGPU::GetCompositableHost()
|
|||||||
return mHost;
|
return mHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gfx::Point
|
||||||
|
PaintedLayerMLGPU::GetDestOrigin() const
|
||||||
|
{
|
||||||
|
return mDestOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PaintedLayerMLGPU::CleanupResources()
|
PaintedLayerMLGPU::CleanupResources()
|
||||||
{
|
{
|
||||||
|
@ -48,9 +48,8 @@ public:
|
|||||||
MOZ_ASSERT(HasComponentAlpha());
|
MOZ_ASSERT(HasComponentAlpha());
|
||||||
return mTextureOnWhite;
|
return mTextureOnWhite;
|
||||||
}
|
}
|
||||||
ContentHostTexture* GetContentHost() const {
|
gfx::Point GetDestOrigin() const;
|
||||||
return mHost;
|
|
||||||
}
|
|
||||||
SamplerMode GetSamplerMode() {
|
SamplerMode GetSamplerMode() {
|
||||||
// Note that when resamping, we must break the texture coordinates into
|
// Note that when resamping, we must break the texture coordinates into
|
||||||
// no-repeat rects. When we have simple integer translations we can
|
// no-repeat rects. When we have simple integer translations we can
|
||||||
@ -78,12 +77,13 @@ protected:
|
|||||||
void CleanupResources();
|
void CleanupResources();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<ContentHostTexture> mHost;
|
RefPtr<ContentHost> mHost;
|
||||||
RefPtr<TextureSource> mTexture;
|
RefPtr<TextureSource> mTexture;
|
||||||
RefPtr<TextureSource> mTextureOnWhite;
|
RefPtr<TextureSource> mTextureOnWhite;
|
||||||
#ifndef MOZ_IGNORE_PAINT_WILL_RESAMPLE
|
#ifndef MOZ_IGNORE_PAINT_WILL_RESAMPLE
|
||||||
LayerIntRegion mDrawRects;
|
LayerIntRegion mDrawRects;
|
||||||
#endif
|
#endif
|
||||||
|
IntPoint mDestOrigin;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
|
@ -457,7 +457,7 @@ TexturedRenderPass::TexturedRenderPass(FrameBuilder* aBuilder, const ItemInfo& a
|
|||||||
TexturedRenderPass::Info::Info(const ItemInfo& aItem, PaintedLayerMLGPU* aLayer)
|
TexturedRenderPass::Info::Info(const ItemInfo& aItem, PaintedLayerMLGPU* aLayer)
|
||||||
: item(aItem),
|
: item(aItem),
|
||||||
textureSize(aLayer->GetTexture()->GetSize()),
|
textureSize(aLayer->GetTexture()->GetSize()),
|
||||||
destOrigin(aLayer->GetContentHost()->GetOriginOffset()),
|
destOrigin(aLayer->GetDestOrigin()),
|
||||||
decomposeIntoNoRepeatRects(aLayer->MayResample())
|
decomposeIntoNoRepeatRects(aLayer->MayResample())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user