Bug 1379322 Don't clear rect when init DrawTargetCapture with OMTP. r=jrmuizel
authorMason Chang <mchang@mozilla.com>
Fri, 07 Jul 2017 18:08:12 -0700
changeset 368267 f691dec773ee7019242e5d2c2402a9a8302b7bdc
parent 368266 6c50a2e45d303a64d805485a2dc0eab1bef20c5e
child 368268 3b5eec74e7e5fdd9f3f92df6f68aa981ecb227a8
push id92448
push usermchang@mozilla.com
push dateTue, 11 Jul 2017 19:35:39 +0000
treeherdermozilla-inbound@f691dec773ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1379322
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1379322 Don't clear rect when init DrawTargetCapture with OMTP. r=jrmuizel
gfx/layers/client/ClientPaintedLayer.cpp
--- a/gfx/layers/client/ClientPaintedLayer.cpp
+++ b/gfx/layers/client/ClientPaintedLayer.cpp
@@ -258,19 +258,21 @@ ClientPaintedLayer::CapturePaintedConten
 
   // DrawTargetCapture requires a reference DT
   // That is used when some API requires a snapshot.
   // TODO: Fixup so DrawTargetCapture lazily creates a reference DT
   RefPtr<DrawTarget> refDT =
     Factory::CreateDrawTarget(gfxPlatform::GetPlatform()->GetDefaultContentBackend(),
                               imageSize, gfx::SurfaceFormat::B8G8R8A8);
 
+  // We don't clear the rect here like WRPaintedBlobLayers do
+  // because ContentClient already clears the surface for us during BeginPaint.
   RefPtr<DrawTargetCapture> captureDT = refDT->CreateCaptureDT(imageSize);
-  captureDT->ClearRect(Rect(0, 0, imageSize.width, imageSize.height));
   captureDT->SetTransform(Matrix().PreTranslate(-bounds.x, -bounds.y));
+
   RefPtr<gfxContext> ctx = gfxContext::CreatePreservingTransformOrNull(captureDT);
   MOZ_ASSERT(ctx); // already checked the target above
 
   ClientManager()->GetPaintedLayerCallback()(this,
                                              ctx,
                                              visibleRegion.ToUnknownRegion(),
                                              visibleRegion.ToUnknownRegion(),
                                              DrawRegionClip::DRAW,