Bug 1238753 - Don't skip the call to StartRemoteDrawing in from BasicCompositor::BeginFrame if the invalid region is empty. r?mattwoodrow draft
authorMarkus Stange <mstange@themasta.com>
Mon, 11 Jan 2016 21:25:45 +0100
changeset 320603 b3bb8d735119d681b161c749c2a39340a6879e26
parent 320602 4cc7aec36d8623086805b37d1f592afdd4dccc73
child 320604 b8352d4025f4c526fd286a1ed122a804fbf56b39
push id9247
push usermstange@themasta.com
push dateMon, 11 Jan 2016 22:41:04 +0000
reviewersmattwoodrow
bugs1238753
milestone46.0a1
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.
gfx/layers/basic/BasicCompositor.cpp
--- 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) {