Bug 1747520 - Ensure that OffscreenCanvas invalidation is in a consistent state. r=gfx-reviewers,kvark

This patch ensures that our invalidation is more consistent and less
frequent. It no longer queues an invalidation for each draw call. It now
combines the parameter update (e.g. width, height, opacity) with an
invalidation to ensure the contents of the canvas are consistent with
the advertised properties. It also ensures that if an explicit commit
occurs, any pending commits are cancelled.

Differential Revision: https://phabricator.services.mozilla.com/D134655
This commit is contained in:
Andrew Osmond
2021-12-24 17:04:39 +00:00
parent f56548352a
commit bc47bc2bda
6 changed files with 115 additions and 91 deletions

View File

@@ -472,10 +472,15 @@ void ClientWebGLContext::UpdateCanvasParameters() {
const auto& options = *mInitialOptions;
const auto& size = DrawingBufferSize();
mOffscreenCanvas->UpdateParameters(
size.x, size.y, options.alpha,
!options.alpha || options.premultipliedAlpha,
/* aIsOriginBottomLeft */ true);
mozilla::dom::OffscreenCanvasDisplayData data;
data.mOriginPos = gl::OriginPos::BottomLeft;
data.mIsOpaque = !options.alpha;
data.mIsAlphaPremult = !options.alpha || options.premultipliedAlpha;
data.mSize = {size.x, size.y};
data.mDoPaintCallbacks = false;
mOffscreenCanvas->UpdateDisplayData(data);
}
layers::LayersBackend ClientWebGLContext::GetCompositorBackendType() const {