Bug 1444447 - Correctly copy drawn surfaces to the full window render target in BasicCompositor r=mstange

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Barret Rennie 2019-04-17 22:29:54 +00:00
Родитель fee1df6e9b
Коммит b99475265f
1 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -1060,21 +1060,21 @@ void BasicCompositor::TryToEndRemoteDrawing(bool aForceToEnd) {
if (mRenderTarget->mDrawTarget != mDrawTarget || mFullWindowRenderTarget) { if (mRenderTarget->mDrawTarget != mDrawTarget || mFullWindowRenderTarget) {
RefPtr<SourceSurface> source; RefPtr<SourceSurface> source;
// Note: Most platforms require us to buffer drawing to the widget
// surface. That's why we don't draw to mDrawTarget directly.
IntPoint srcOffset = mTarget ? mTargetBounds.TopLeft() : IntPoint();
IntPoint dstOffset = mRenderTarget->GetOrigin();
if (mRenderTarget->mDrawTarget != mDrawTarget) { if (mRenderTarget->mDrawTarget != mDrawTarget) {
source = mWidget->EndBackBufferDrawing(); source = mWidget->EndBackBufferDrawing();
// Note: Most platforms require us to buffer drawing to the widget
// surface. That's why we don't draw to mDrawTarget directly.
nsIntPoint offset = mTarget ? mTargetBounds.TopLeft() : nsIntPoint();
// The source DrawTarget is clipped to the invalidation region, so we have // The source DrawTarget is clipped to the invalidation region, so we have
// to copy the individual rectangles in the region or else we'll draw // to copy the individual rectangles in the region or else we'll draw
// blank pixels. // blank pixels.
for (auto iter = mInvalidRegion.RectIter(); !iter.Done(); iter.Next()) { for (auto iter = mInvalidRegion.RectIter(); !iter.Done(); iter.Next()) {
const LayoutDeviceIntRect& r = iter.Get(); const LayoutDeviceIntRect& r = iter.Get();
mDrawTarget->CopySurface(source, mDrawTarget->CopySurface(source, r.ToUnknownRect() - srcOffset,
r.ToUnknownRect() - mRenderTarget->GetOrigin(), r.TopLeft().ToUnknownPoint() - dstOffset);
r.TopLeft().ToUnknownPoint() - offset);
} }
} else { } else {
source = mRenderTarget->mDrawTarget->Snapshot(); source = mRenderTarget->mDrawTarget->Snapshot();
@ -1084,7 +1084,8 @@ void BasicCompositor::TryToEndRemoteDrawing(bool aForceToEnd) {
for (auto iter = mInvalidRegion.RectIter(); !iter.Done(); iter.Next()) { for (auto iter = mInvalidRegion.RectIter(); !iter.Done(); iter.Next()) {
const LayoutDeviceIntRect& r = iter.Get(); const LayoutDeviceIntRect& r = iter.Get();
mFullWindowRenderTarget->mDrawTarget->CopySurface( mFullWindowRenderTarget->mDrawTarget->CopySurface(
source, r.ToUnknownRect(), r.TopLeft().ToUnknownPoint()); source, r.ToUnknownRect() - srcOffset,
r.TopLeft().ToUnknownPoint() - dstOffset);
} }
mFullWindowRenderTarget->mDrawTarget->Flush(); mFullWindowRenderTarget->mDrawTarget->Flush();