Bug 1526045: Avoid invalid DrawTargets when not using OMTP. r=rhunt a=lizzard
authorBas Schouten <bschouten@mozilla.com>
Mon, 18 Feb 2019 16:43:08 +0100
changeset 516130 91995baa7317a9f8db9ce9e2882479f54ec5f94e
parent 516129 2589bf262f6576b3e0bce80179c54691fc28c21e
child 516131 55767ac12338a289523e1840b13b36ef6a1174e1
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt, lizzard
bugs1526045
milestone66.0
Bug 1526045: Avoid invalid DrawTargets when not using OMTP. r=rhunt a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D20182
gfx/layers/client/ClientPaintedLayer.cpp
--- a/gfx/layers/client/ClientPaintedLayer.cpp
+++ b/gfx/layers/client/ClientPaintedLayer.cpp
@@ -142,20 +142,30 @@ void ClientPaintedLayer::RenderLayerWith
              mContentClient->BorrowDrawTargetForPainting(state, &iter)) {
     SetAntialiasingFlags(this, target);
 
     RefPtr<gfxContext> ctx =
         gfxContext::CreatePreservingTransformOrNull(target);
     MOZ_ASSERT(ctx);  // already checked the target above
 
     if (!gfxEnv::SkipRasterization()) {
-      ClientManager()->GetPaintedLayerCallback()(
-          this, ctx, iter.mDrawRegion, iter.mDrawRegion, state.mClip,
-          state.mRegionToInvalidate,
-          ClientManager()->GetPaintedLayerCallbackData());
+      if (!target->IsCaptureDT()) {
+        target->ClearRect(Rect());
+        if (target->IsValid()) {
+          ClientManager()->GetPaintedLayerCallback()(
+              this, ctx, iter.mDrawRegion, iter.mDrawRegion, state.mClip,
+              state.mRegionToInvalidate,
+              ClientManager()->GetPaintedLayerCallbackData());
+        }
+      } else {
+        ClientManager()->GetPaintedLayerCallback()(
+            this, ctx, iter.mDrawRegion, iter.mDrawRegion, state.mClip,
+            state.mRegionToInvalidate,
+            ClientManager()->GetPaintedLayerCallbackData());
+      }
     }
 
     ctx = nullptr;
     mContentClient->ReturnDrawTarget(target);
     didUpdate = true;
   }
 
   mContentClient->EndPaint(state, &readbackUpdates);