зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1574745 - Make DrawGeometry culling work more reliably. r=mattwoodrow
The call to TransformAndClipBounds already clips destRect to renderBounds. However, if the resulting rect was empty, the Inflate call would make it non-empty again. And now the decision whether we would cull would depend on the rect's position: Sometimes TransformAndClipBounds would place the empty rect at a position along an edge of renderBounds, and then the inflated-from-nothingness 2x2 rect would overlap renderBounds and we wouldn't cull. Differential Revision: https://phabricator.services.mozilla.com/D43870 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4bcd4b8795
Коммит
cb05c82010
|
@ -1288,9 +1288,6 @@ void CompositorOGL::DrawGeometry(const Geometry& aGeometry,
|
|||
|
||||
MakeCurrent();
|
||||
|
||||
IntPoint offset = mCurrentRenderTarget->GetOrigin();
|
||||
IntSize size = mCurrentRenderTarget->GetSize();
|
||||
|
||||
// Convert aClipRect into render target space, and intersect it with the
|
||||
// render target's clip.
|
||||
IntRect clipRect = aClipRect + mCurrentRenderTarget->GetClipSpaceOrigin();
|
||||
|
@ -1298,23 +1295,16 @@ void CompositorOGL::DrawGeometry(const Geometry& aGeometry,
|
|||
clipRect = clipRect.Intersect(*rtClip);
|
||||
}
|
||||
|
||||
Rect renderBound(mCurrentRenderTarget->GetRect().Intersect(clipRect));
|
||||
|
||||
Rect destRect = aTransform.TransformAndClipBounds(aRect, renderBound);
|
||||
Rect destRect = aTransform.TransformAndClipBounds(
|
||||
aRect, Rect(mCurrentRenderTarget->GetRect().Intersect(clipRect)));
|
||||
if (destRect.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// XXX: This doesn't handle 3D transforms. It also doesn't handled rotated
|
||||
// quads. Fix me.
|
||||
mPixelsFilled += destRect.Area();
|
||||
|
||||
// Do a simple culling if this rect is out of target buffer.
|
||||
// Inflate a small size to avoid some numerical imprecision issue.
|
||||
destRect.Inflate(1, 1);
|
||||
destRect.MoveBy(-offset);
|
||||
renderBound = Rect(0, 0, size.width, size.height);
|
||||
if (!renderBound.Intersects(destRect)) {
|
||||
return;
|
||||
}
|
||||
|
||||
LayerScope::DrawBegin();
|
||||
|
||||
EffectMask* effectMask;
|
||||
|
@ -1338,6 +1328,7 @@ void CompositorOGL::DrawGeometry(const Geometry& aGeometry,
|
|||
}
|
||||
|
||||
// Move clipRect into device space.
|
||||
IntPoint offset = mCurrentRenderTarget->GetOrigin();
|
||||
clipRect -= offset;
|
||||
|
||||
// clipRect is in destination coordinate space (after all
|
||||
|
|
Загрузка…
Ссылка в новой задаче