Bug 1576499 - Clarify dest and buffer a little. r=mattwoodrow
authorMarkus Stange <mstange@themasta.com>
Wed, 28 Aug 2019 21:50:27 +0000
changeset 554281 b80e328a4f866ec09a880e8112f24b61d97e22e0
parent 554280 0c2e876254cb9c6a297a3abc5401ddcffc71b944
child 554282 f3f1c60d1991888c0c72f72978f40c371e38e2e0
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1576499
milestone70.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 1576499 - Clarify dest and buffer a little. r=mattwoodrow The old code was making an autoRestoreTransform around dest and then quickly overwriting dest with something new. I prefer creating the autoRestoreTransform for buffer, which doesn't change over the course of this function. Differential Revision: https://phabricator.services.mozilla.com/D43384
gfx/layers/basic/BasicCompositor.cpp
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -614,29 +614,29 @@ void BasicCompositor::DrawPolygon(const 
 
 template <typename Geometry>
 void BasicCompositor::DrawGeometry(
     const Geometry& aGeometry, const gfx::Rect& aRect,
     const gfx::IntRect& aClipRect, const EffectChain& aEffectChain,
     gfx::Float aOpacity, const gfx::Matrix4x4& aTransform,
     const gfx::Rect& aVisibleRect, const bool aEnableAA) {
   RefPtr<DrawTarget> buffer = mRenderTarget->mDrawTarget;
-
-  // For 2D drawing, |dest| and |buffer| are the same surface. For 3D drawing,
-  // |dest| is a temporary surface.
-  RefPtr<DrawTarget> dest = buffer;
-
-  AutoRestoreTransform autoRestoreTransform(dest);
+  AutoRestoreTransform autoRestoreTransform(buffer);
 
   Matrix newTransform;
   Rect transformBounds;
   Matrix4x4 new3DTransform;
   IntPoint offset = mRenderTarget->GetOrigin();
 
+  // For 2D drawing, |dest| and |buffer| are the same surface. For 3D drawing,
+  // |dest| is a temporary surface.
+  RefPtr<DrawTarget> dest;
+
   if (aTransform.Is2D()) {
+    dest = buffer;
     newTransform = aTransform.As2D();
   } else {
     // Create a temporary surface for the transform.
     dest = Factory::CreateDrawTarget(gfxVars::ContentBackend(),
                                      RoundedOut(aRect).Size(),
                                      SurfaceFormat::B8G8R8A8);
     if (!dest) {
       return;