Bug 995721 patch 1 - Honor the translation on mShadowTarget in ClientLayerManager::MakeSnapshotIfRequired. r=mattwoodrow
authorL. David Baron <dbaron@dbaron.org>
Mon, 14 Apr 2014 11:12:00 -0700
changeset 196886 4428373539b7edf1c399ac3523980cd936ca592d
parent 196885 33bfd3ceee1f57e75614971b51963f467d2cf2b2
child 196887 7ba6e4eeb392ba744d54020a0a4a8ef8614e244b
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs995721
milestone31.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 995721 patch 1 - Honor the translation on mShadowTarget in ClientLayerManager::MakeSnapshotIfRequired. r=mattwoodrow This switches from DrawTarget::CopySurface (which ignores the transform) to DrawSurface (which honors the transform).
gfx/layers/client/ClientLayerManager.cpp
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -276,28 +276,31 @@ ClientLayerManager::MakeSnapshotIfRequir
 {
   if (!mShadowTarget) {
     return;
   }
   if (mWidget) {
     if (CompositorChild* remoteRenderer = GetRemoteRenderer()) {
       nsIntRect bounds;
       mWidget->GetBounds(bounds);
+      IntSize widgetSize = bounds.Size().ToIntSize();
       SurfaceDescriptor inSnapshot, snapshot;
-      if (mForwarder->AllocSurfaceDescriptor(bounds.Size().ToIntSize(),
+      if (mForwarder->AllocSurfaceDescriptor(widgetSize,
                                              gfxContentType::COLOR_ALPHA,
                                              &inSnapshot) &&
           // The compositor will usually reuse |snapshot| and return
           // it through |outSnapshot|, but if it doesn't, it's
           // responsible for freeing |snapshot|.
           remoteRenderer->SendMakeSnapshot(inSnapshot, &snapshot)) {
         RefPtr<DataSourceSurface> surf = GetSurfaceForDescriptor(snapshot);
-        mShadowTarget->GetDrawTarget()->CopySurface(surf,
-                                                    IntRect(0, 0, bounds.Size().width, bounds.Size().height),
-                                                    IntPoint(0, 0));
+        DrawTarget* dt = mShadowTarget->GetDrawTarget();
+        Rect widgetRect(Point(0, 0), Size(widgetSize.width, widgetSize.height));
+        dt->DrawSurface(surf, widgetRect, widgetRect,
+                        DrawSurfaceOptions(),
+                        DrawOptions(1.0f, CompositionOp::OP_OVER));
       }
       if (IsSurfaceDescriptorValid(snapshot)) {
         mForwarder->DestroySharedSurface(&snapshot);
       }
     }
   }
   mShadowTarget = nullptr;
 }