Bug 1434503 - Round video frame images bounds to device pixel boundaries before passing to WebRender. r=sotaro

When scrolling on Twitter video frames can sometimes be drawn with a flicker
above or below them. This is because the bounds for video frames' images that
we pass to WebRender are not rounded to pixel boundaries, and so they can end
up being rounded off in WebRender unexpectedly when composited.

So round off the bounds of video frame images to device pixel boundaries before
passing to WebRender.

Differential Revision: https://phabricator.services.mozilla.com/D6857
This commit is contained in:
Chris Pearce
2018-09-26 00:18:21 +00:00
parent 7231bc4d71
commit c6e51d4e51

View File

@@ -381,7 +381,7 @@ AsyncImagePipelineManager::ApplyAsyncImageForPipeline(const wr::Epoch& aEpoch,
float opacity = 1.0f;
Maybe<wr::WrClipId> referenceFrameId = builder.PushStackingContext(
wr::ToLayoutRect(aPipeline->mScBounds),
wr::ToRoundedLayoutRect(aPipeline->mScBounds),
nullptr,
nullptr,
&opacity,
@@ -404,15 +404,15 @@ AsyncImagePipelineManager::ApplyAsyncImageForPipeline(const wr::Epoch& aEpoch,
MOZ_ASSERT(aPipeline->mCurrentTexture->AsWebRenderTextureHost());
Range<wr::ImageKey> range_keys(&keys[0], keys.Length());
aPipeline->mCurrentTexture->PushDisplayItems(builder,
wr::ToLayoutRect(rect),
wr::ToLayoutRect(rect),
wr::ToRoundedLayoutRect(rect),
wr::ToRoundedLayoutRect(rect),
aPipeline->mFilter,
range_keys);
HoldExternalImage(aPipelineId, aEpoch, aPipeline->mCurrentTexture->AsWebRenderTextureHost());
} else {
MOZ_ASSERT(keys.Length() == 1);
builder.PushImage(wr::ToLayoutRect(rect),
wr::ToLayoutRect(rect),
builder.PushImage(wr::ToRoundedLayoutRect(rect),
wr::ToRoundedLayoutRect(rect),
true,
aPipeline->mFilter,
keys[0]);