Bug 1547159 - Composite just the visible rects of ColorLayerComposite on mobile. r=jnicol

Differential Revision: https://phabricator.services.mozilla.com/D29456

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-05-02 22:02:30 +00:00
parent ea5af71605
commit ccec906120

View File

@ -22,19 +22,32 @@ using namespace mozilla::gfx;
void ColorLayerComposite::RenderLayer(const gfx::IntRect& aClipRect,
const Maybe<gfx::Polygon>& aGeometry) {
Rect rect(GetBounds());
const Matrix4x4& transform = GetEffectiveTransform();
RenderWithAllMasks(this, mCompositor, aClipRect,
[&](EffectChain& effectChain, const IntRect& clipRect) {
GenEffectChain(effectChain);
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
// On desktop we want to draw a single rectangle to avoid possible
// seams if we're resampling. On mobile we'd prefer to use the accurate
// region for better performance.
LayerIntRegion drawRegion = GetLocalVisibleRegion();
#else
LayerIntRegion drawRegion = ViewAs<LayerPixel>(GetBounds());
#endif
mCompositor->DrawGeometry(rect, clipRect, effectChain,
GetEffectiveOpacity(),
transform, aGeometry);
});
for (auto iter = drawRegion.RectIter(); !iter.Done(); iter.Next()) {
const LayerIntRect& rect = iter.Get();
Rect graphicsRect(rect.X(), rect.Y(), rect.Width(), rect.Height());
RenderWithAllMasks(this, mCompositor, aClipRect,
[&](EffectChain& effectChain, const IntRect& clipRect) {
GenEffectChain(effectChain);
mCompositor->DrawGeometry(
graphicsRect, clipRect, effectChain,
GetEffectiveOpacity(), transform, aGeometry);
});
}
Rect rect(GetBounds());
mCompositor->DrawDiagnostics(DiagnosticFlags::COLOR, rect, aClipRect,
transform);
}