Bug 1238753 - Don't skip the call to StartRemoteDrawing in from BasicCompositor::BeginFrame if the invalid region is empty. r?mattwoodrow
Sometimes we need a composition even if nothing has changed, for example for window resizes on Mac.
LayerManagerComposite::UpdateAndRender() already has a check that skips the call to BasicCompositor
if it's not necessary.
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -525,29 +525,29 @@ BasicCompositor::BeginFrame(const nsIntR
mInvalidRegion = invalidRegionSafe;
mInvalidRect = mInvalidRegion.GetBounds();
if (aRenderBoundsOut) {
*aRenderBoundsOut = Rect();
}
- if (mInvalidRect.width <= 0 || mInvalidRect.height <= 0) {
- return;
- }
-
if (mTarget) {
// If we have a copy target, then we don't have a widget-provided mDrawTarget (currently). Use a dummy
// placeholder so that CreateRenderTarget() works.
mDrawTarget = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
} else {
mDrawTarget = mWidget->StartRemoteDrawingInRegion(mInvalidRegion);
mInvalidRect = mInvalidRegion.GetBounds();
+ if (mInvalidRect.IsEmpty()) {
+ mWidget->EndRemoteDrawingInRegion(mDrawTarget, mInvalidRegion);
+ }
}
- if (!mDrawTarget) {
+
+ if (!mDrawTarget || mInvalidRect.IsEmpty()) {
return;
}
// Setup an intermediate render target to buffer all compositing. We will
// copy this into mDrawTarget (the widget), and/or mTarget in EndFrame()
RefPtr<CompositingRenderTarget> target = CreateRenderTarget(mInvalidRect, INIT_MODE_CLEAR);
if (!target) {
if (!mTarget) {