Remove Compositor::mRenderBounds. (bug 1243071 part 1, r=mattwoodrow)

This commit is contained in:
David Anderson 2016-02-01 16:27:38 -08:00
parent 0d7177e531
commit c4cf08e7cd
3 changed files with 25 additions and 12 deletions

View File

@ -357,23 +357,37 @@ DecomposeIntoNoRepeatRects(const gfx::Rect& aRect,
gfx::IntRect
Compositor::ComputeBackdropCopyRect(const gfx::Rect& aRect,
const gfx::Rect& aClipRect,
const gfx::Matrix4x4& aTransform)
const gfx::Matrix4x4& aTransform,
gfx::Matrix4x4* aOutTransform)
{
gfx::Rect renderBounds = mRenderBounds;
// Compute the clip.
gfx::IntPoint offset = GetCurrentRenderTarget()->GetOrigin();
gfx::IntPoint rtOffset = GetCurrentRenderTarget()->GetOrigin();
gfx::IntSize rtSize = GetCurrentRenderTarget()->GetSize();
gfx::Rect renderBounds(0, 0, rtSize.width, rtSize.height);
renderBounds.IntersectRect(renderBounds, aClipRect);
renderBounds.MoveBy(offset);
renderBounds.MoveBy(rtOffset);
// Apply the layer transform.
gfx::Rect dest = aTransform.TransformAndClipBounds(aRect, renderBounds);
dest -= offset;
dest -= rtOffset;
// Ensure we don't round out to -1, which trips up Direct3D.
dest.IntersectRect(dest, gfx::Rect(0, 0, rtSize.width, rtSize.height));
// Round out to integer.
gfx::IntRect result;
dest.RoundOut();
dest.ToIntRect(&result);
// Create a transform from adjusted clip space to render target space,
// translate it for the backdrop rect, then transform it into the backdrop's
// uv-space.
gfx::Matrix4x4 transform;
transform.PostScale(rtSize.width, rtSize.height, 1.0);
transform.PostTranslate(-result.x, -result.y, 0.0);
transform.PostScale(1 / float(result.width), 1 / float(result.height), 1.0);
*aOutTransform = transform;
return result;
}

View File

@ -552,8 +552,6 @@ protected:
RefPtr<gfx::DrawTarget> mTarget;
gfx::IntRect mTargetBounds;
gfx::Rect mRenderBounds;
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
FenceHandle mReleaseFenceHandle;
#endif

View File

@ -486,8 +486,6 @@ CompositorOGL::PrepareViewport(CompositingRenderTargetOGL* aRenderTarget)
// Set the viewport correctly.
mGLContext->fViewport(0, 0, size.width, size.height);
mRenderBounds = Rect(0, 0, size.width, size.height);
mViewportSize = size;
if (!aRenderTarget->HasComplexProjection()) {
@ -1007,7 +1005,9 @@ CompositorOGL::DrawQuad(const Rect& aRect,
}
IntPoint offset = mCurrentRenderTarget->GetOrigin();
Rect renderBound = mRenderBounds;
IntSize size = mCurrentRenderTarget->GetSize();
Rect renderBound(0, 0, size.width, size.height);
renderBound.IntersectRect(renderBound, aClipRect);
renderBound.MoveBy(offset);
@ -1021,7 +1021,8 @@ CompositorOGL::DrawQuad(const Rect& aRect,
// Inflate a small size to avoid some numerical imprecision issue.
destRect.Inflate(1, 1);
destRect.MoveBy(-offset);
if (!mRenderBounds.Intersects(destRect)) {
renderBound = Rect(0, 0, size.width, size.height);
if (!renderBound.Intersects(destRect)) {
return;
}