Bug 973976 - Revert to Thebes path for CopyableCanvasLayer. r=jmuizelaar
authorTor Arvid Lund <torarvid@comoyo.com>
Mon, 17 Mar 2014 10:49:21 -0400
changeset 192147 c737dc096ba0aaa6408686eb8fe9264fbaf10954
parent 192146 b1e0e1576f3824381e2f26a88f56d66c6406c71b
child 192148 0b59bee9d3d2f85a1bb02ffcd929a76de6a357e6
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar
bugs973976, 948765
milestone30.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 973976 - Revert to Thebes path for CopyableCanvasLayer. r=jmuizelaar The performance on the Mac platform degraded after porting the code to Moz2D in Bug 948765. This patch chooses the old thebes path instead of the Moz2D path, so that performance is unaffected. This way we can easily revert this patch at a later time when the perf issue has been fixed.
gfx/layers/CopyableCanvasLayer.cpp
gfx/layers/client/CanvasClient.cpp
--- a/gfx/layers/CopyableCanvasLayer.cpp
+++ b/gfx/layers/CopyableCanvasLayer.cpp
@@ -285,18 +285,21 @@ CopyableCanvasLayer::PaintWithOpacity(gf
   }
 
   DrawOptions options = DrawOptions(aOpacity, CompositionOp::OP_SOURCE);
 
   if (aOperator != CompositionOp::OP_OVER) {
     options.mCompositionOp = aOperator;
   }
 
+  // XXX: This needs rewriting for acceptable performance using CoreGraphics.
+  // Therefore - this ::PaintWithOpacity is currently not used
   Rect rect = Rect(0, 0, mBounds.width, mBounds.height);
   aTarget->FillRect(rect, pat, options);
+
   if (aMaskSurface) {
     aTarget->MaskSurface(pat, aMaskSurface, Point(0, 0), options);
   }
 
   if (mNeedsYFlip) {
     aTarget->SetTransform(oldTransform);
   }
 }
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -74,20 +74,20 @@ CanvasClient2D::Update(gfx::IntSize aSiz
 
   if (!mBuffer->Lock(OPEN_WRITE_ONLY)) {
     return;
   }
 
   bool updated = false;
   {
     // Restrict drawTarget to a scope so that terminates before Unlock.
-    RefPtr<DrawTarget> drawTarget =
-      mBuffer->AsTextureClientDrawTarget()->GetAsDrawTarget();
-    if (drawTarget) {
-      aLayer->UpdateTarget(drawTarget);
+    nsRefPtr<gfxASurface> surface =
+      mBuffer->AsTextureClientSurface()->GetAsSurface();
+    if (surface) {
+      aLayer->DeprecatedUpdateSurface(surface);
       updated = true;
     }
   }
   mBuffer->Unlock();
 
   if (bufferCreated && !AddTextureClient(mBuffer)) {
     mBuffer = nullptr;
     return;