зеркало из https://github.com/mozilla/gecko-dev.git
Propagate the compositor through CompositableHost::Composite. (bug 1343814 part 4, r=mattwoodrow)
--HG-- extra : rebase_source : 31b056537526e51192feeebf8a29e8d22d1ad88d
This commit is contained in:
Родитель
a73b2f32a3
Коммит
689f898870
|
@ -89,7 +89,7 @@ CanvasLayerComposite::RenderLayer(const IntRect& aClipRect,
|
|||
|
||||
RenderWithAllMasks(this, mCompositor, aClipRect,
|
||||
[&](EffectChain& effectChain, const IntRect& clipRect) {
|
||||
mCompositableHost->Composite(this, effectChain,
|
||||
mCompositableHost->Composite(mCompositor, this, effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
GetEffectiveTransform(),
|
||||
GetSamplingFilter(),
|
||||
|
|
|
@ -94,7 +94,8 @@ public:
|
|||
virtual void SetCompositor(Compositor* aCompositor);
|
||||
|
||||
// composite the contents of this buffer host to the compositor's surface
|
||||
virtual void Composite(LayerComposite* aLayer,
|
||||
virtual void Composite(Compositor* aCompositor,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
|
|
@ -32,7 +32,8 @@ ContentHostBase::~ContentHostBase()
|
|||
}
|
||||
|
||||
void
|
||||
ContentHostTexture::Composite(LayerComposite* aLayer,
|
||||
ContentHostTexture::Composite(Compositor* aCompositor,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
@ -181,16 +182,16 @@ ContentHostTexture::Composite(LayerComposite* aLayer,
|
|||
Float(tileRegionRect.width) / texRect.width,
|
||||
Float(tileRegionRect.height) / texRect.height);
|
||||
|
||||
GetCompositor()->DrawGeometry(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform, aGeometry);
|
||||
aCompositor->DrawGeometry(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform, aGeometry);
|
||||
|
||||
if (usingTiles) {
|
||||
DiagnosticFlags diagnostics = DiagnosticFlags::CONTENT | DiagnosticFlags::BIGIMAGE;
|
||||
if (iterOnWhite) {
|
||||
diagnostics |= DiagnosticFlags::COMPONENT_ALPHA;
|
||||
}
|
||||
GetCompositor()->DrawDiagnostics(diagnostics, rect, aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
aCompositor->DrawDiagnostics(diagnostics, rect, aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -212,8 +213,8 @@ ContentHostTexture::Composite(LayerComposite* aLayer,
|
|||
if (iterOnWhite) {
|
||||
diagnostics |= DiagnosticFlags::COMPONENT_ALPHA;
|
||||
}
|
||||
GetCompositor()->DrawDiagnostics(diagnostics, nsIntRegion(mBufferRect), aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
aCompositor->DrawDiagnostics(diagnostics, nsIntRegion(mBufferRect), aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -117,7 +117,8 @@ public:
|
|||
, mReceivedNewHost(false)
|
||||
{ }
|
||||
|
||||
virtual void Composite(LayerComposite* aLayer,
|
||||
virtual void Composite(Compositor* aCompositor,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
|
|
@ -188,7 +188,8 @@ void ImageHost::Attach(Layer* aLayer,
|
|||
}
|
||||
|
||||
void
|
||||
ImageHost::Composite(LayerComposite* aLayer,
|
||||
ImageHost::Composite(Compositor* aCompositor,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
@ -212,7 +213,7 @@ ImageHost::Composite(LayerComposite* aLayer,
|
|||
}
|
||||
|
||||
TimedImage* img = &mImages[imageIndex];
|
||||
img->mTextureHost->SetTextureSourceProvider(GetCompositor());
|
||||
img->mTextureHost->SetTextureSourceProvider(aCompositor);
|
||||
SetCurrentTextureHost(img->mTextureHost);
|
||||
|
||||
{
|
||||
|
@ -241,7 +242,7 @@ ImageHost::Composite(LayerComposite* aLayer,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!GetCompositor()->SupportsEffect(effect->mType)) {
|
||||
if (!aCompositor->SupportsEffect(effect->mType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -300,15 +301,15 @@ ImageHost::Composite(LayerComposite* aLayer,
|
|||
effect->mTextureCoords.y = effect->mTextureCoords.YMost();
|
||||
effect->mTextureCoords.height = -effect->mTextureCoords.height;
|
||||
}
|
||||
GetCompositor()->DrawGeometry(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform, aGeometry);
|
||||
GetCompositor()->DrawDiagnostics(diagnosticFlags | DiagnosticFlags::BIGIMAGE,
|
||||
rect, aClipRect, aTransform, mFlashCounter);
|
||||
aCompositor->DrawGeometry(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform, aGeometry);
|
||||
aCompositor->DrawDiagnostics(diagnosticFlags | DiagnosticFlags::BIGIMAGE,
|
||||
rect, aClipRect, aTransform, mFlashCounter);
|
||||
} while (it->NextTile());
|
||||
it->EndBigImageIteration();
|
||||
// layer border
|
||||
GetCompositor()->DrawDiagnostics(diagnosticFlags, pictureRect,
|
||||
aClipRect, aTransform, mFlashCounter);
|
||||
aCompositor->DrawDiagnostics(diagnosticFlags, pictureRect,
|
||||
aClipRect, aTransform, mFlashCounter);
|
||||
} else {
|
||||
IntSize textureSize = mCurrentTextureSource->GetSize();
|
||||
effect->mTextureCoords = Rect(Float(img->mPictureRect.x) / textureSize.width,
|
||||
|
@ -321,11 +322,11 @@ ImageHost::Composite(LayerComposite* aLayer,
|
|||
effect->mTextureCoords.height = -effect->mTextureCoords.height;
|
||||
}
|
||||
|
||||
GetCompositor()->DrawGeometry(pictureRect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform, aGeometry);
|
||||
GetCompositor()->DrawDiagnostics(diagnosticFlags,
|
||||
pictureRect, aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
aCompositor->DrawGeometry(pictureRect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform, aGeometry);
|
||||
aCompositor->DrawDiagnostics(diagnosticFlags,
|
||||
pictureRect, aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ public:
|
|||
|
||||
virtual CompositableType GetType() override { return mTextureInfo.mCompositableType; }
|
||||
|
||||
virtual void Composite(LayerComposite* aLayer,
|
||||
virtual void Composite(Compositor* aCompositor,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
|
|
@ -102,7 +102,7 @@ ImageLayerComposite::RenderLayer(const IntRect& aClipRect,
|
|||
RenderWithAllMasks(this, mCompositor, aClipRect,
|
||||
[&](EffectChain& effectChain, const IntRect& clipRect) {
|
||||
mImageHost->SetCompositor(mCompositor);
|
||||
mImageHost->Composite(this, effectChain,
|
||||
mImageHost->Composite(mCompositor, this, effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
GetEffectiveTransformForBuffer(),
|
||||
GetSamplingFilter(),
|
||||
|
|
|
@ -121,7 +121,7 @@ PaintedLayerComposite::RenderLayer(const gfx::IntRect& aClipRect,
|
|||
const gfx::IntRect& clipRect) {
|
||||
mBuffer->SetPaintWillResample(MayResample());
|
||||
|
||||
mBuffer->Composite(this, effectChain, GetEffectiveOpacity(),
|
||||
mBuffer->Composite(compositor, this, effectChain, GetEffectiveOpacity(),
|
||||
GetEffectiveTransform(), GetSamplingFilter(),
|
||||
clipRect, &visibleRegion, aGeometry);
|
||||
});
|
||||
|
|
|
@ -389,7 +389,8 @@ TiledLayerBufferComposite::Clear()
|
|||
}
|
||||
|
||||
void
|
||||
TiledContentHost::Composite(LayerComposite* aLayer,
|
||||
TiledContentHost::Composite(Compositor* aCompositor,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
@ -398,7 +399,6 @@ TiledContentHost::Composite(LayerComposite* aLayer,
|
|||
const nsIntRegion* aVisibleRegion /* = nullptr */,
|
||||
const Maybe<gfx::Polygon>& aGeometry)
|
||||
{
|
||||
MOZ_ASSERT(mCompositor);
|
||||
// Reduce the opacity of the low-precision buffer to make it a
|
||||
// little more subtle and less jarring. In particular, text
|
||||
// rendered at low-resolution and scaled tends to look pretty
|
||||
|
@ -438,18 +438,19 @@ TiledContentHost::Composite(LayerComposite* aLayer,
|
|||
#endif
|
||||
|
||||
// Render the low and high precision buffers.
|
||||
RenderLayerBuffer(mLowPrecisionTiledBuffer,
|
||||
RenderLayerBuffer(mLowPrecisionTiledBuffer, aCompositor,
|
||||
lowPrecisionOpacityReduction < 1.0f ? &backgroundColor : nullptr,
|
||||
aEffectChain, lowPrecisionOpacityReduction * aOpacity,
|
||||
aSamplingFilter, aClipRect, *renderRegion, aTransform, aGeometry);
|
||||
|
||||
RenderLayerBuffer(mTiledBuffer, nullptr, aEffectChain, aOpacity, aSamplingFilter,
|
||||
RenderLayerBuffer(mTiledBuffer, aCompositor, nullptr, aEffectChain, aOpacity, aSamplingFilter,
|
||||
aClipRect, *renderRegion, aTransform, aGeometry);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TiledContentHost::RenderTile(TileHost& aTile,
|
||||
Compositor* aCompositor,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
@ -502,7 +503,7 @@ TiledContentHost::RenderTile(TileHost& aTile,
|
|||
textureRect.width / aTextureBounds.width,
|
||||
textureRect.height / aTextureBounds.height);
|
||||
|
||||
mCompositor->DrawGeometry(graphicsRect, aClipRect, aEffectChain, opacity,
|
||||
aCompositor->DrawGeometry(graphicsRect, aClipRect, aEffectChain, opacity,
|
||||
aTransform, aVisibleRect, aGeometry);
|
||||
}
|
||||
|
||||
|
@ -510,12 +511,13 @@ TiledContentHost::RenderTile(TileHost& aTile,
|
|||
if (aTile.mTextureHostOnWhite) {
|
||||
flags |= DiagnosticFlags::COMPONENT_ALPHA;
|
||||
}
|
||||
mCompositor->DrawDiagnostics(flags,
|
||||
aCompositor->DrawDiagnostics(flags,
|
||||
aScreenRegion, aClipRect, aTransform, mFlashCounter);
|
||||
}
|
||||
|
||||
void
|
||||
TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
||||
Compositor* aCompositor,
|
||||
const Color* aBackgroundColor,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
|
@ -525,10 +527,6 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|||
gfx::Matrix4x4 aTransform,
|
||||
const Maybe<Polygon>& aGeometry)
|
||||
{
|
||||
if (!mCompositor) {
|
||||
NS_WARNING("Can't render tiled content host - no compositor");
|
||||
return;
|
||||
}
|
||||
float resolution = aLayerBuffer.GetResolution();
|
||||
gfx::Size layerScale(1, 1);
|
||||
|
||||
|
@ -579,7 +577,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|||
for (auto iter = backgroundRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& rect = iter.Get();
|
||||
Rect graphicsRect(rect.x, rect.y, rect.width, rect.height);
|
||||
mCompositor->DrawGeometry(graphicsRect, aClipRect, effect,
|
||||
aCompositor->DrawGeometry(graphicsRect, aClipRect, effect,
|
||||
1.0, aTransform, aGeometry);
|
||||
}
|
||||
}
|
||||
|
@ -603,7 +601,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|||
}
|
||||
|
||||
tileDrawRegion.ScaleRoundOut(resolution, resolution);
|
||||
RenderTile(tile, aEffectChain, aOpacity,
|
||||
RenderTile(tile, aCompositor, aEffectChain, aOpacity,
|
||||
aTransform, aSamplingFilter, aClipRect, tileDrawRegion,
|
||||
tileOffset * resolution, aLayerBuffer.GetTileSize(),
|
||||
gfx::Rect(visibleRect.x, visibleRect.y,
|
||||
|
@ -617,8 +615,8 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|||
|
||||
gfx::Rect rect(visibleRect.x, visibleRect.y,
|
||||
visibleRect.width, visibleRect.height);
|
||||
GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTENT | componentAlphaDiagnostic,
|
||||
rect, aClipRect, aTransform, mFlashCounter);
|
||||
aCompositor->DrawDiagnostics(DiagnosticFlags::CONTENT | componentAlphaDiagnostic,
|
||||
rect, aClipRect, aTransform, mFlashCounter);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -205,7 +205,8 @@ public:
|
|||
bool UseTiledLayerBuffer(ISurfaceAllocator* aAllocator,
|
||||
const SurfaceDescriptorTiles& aTiledDescriptor);
|
||||
|
||||
virtual void Composite(LayerComposite* aLayer,
|
||||
virtual void Composite(Compositor* aCompositor,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
@ -236,6 +237,7 @@ public:
|
|||
private:
|
||||
|
||||
void RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
||||
Compositor* aCompositor,
|
||||
const gfx::Color* aBackgroundColor,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
|
@ -247,6 +249,7 @@ private:
|
|||
|
||||
// Renders a single given tile.
|
||||
void RenderTile(TileHost& aTile,
|
||||
Compositor* aCompositor,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
|
|
@ -114,7 +114,8 @@ void WebRenderImageHost::Attach(Layer* aLayer,
|
|||
}
|
||||
|
||||
void
|
||||
WebRenderImageHost::Composite(LayerComposite* aLayer,
|
||||
WebRenderImageHost::Composite(Compositor* aCompositor,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
|
|
@ -24,7 +24,8 @@ public:
|
|||
|
||||
virtual CompositableType GetType() override { return mTextureInfo.mCompositableType; }
|
||||
|
||||
virtual void Composite(LayerComposite* aLayer,
|
||||
virtual void Composite(Compositor* aCompositor,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
|
|
Загрузка…
Ссылка в новой задаче