Bug 969591 - Cleanup Thebes Layer if mRegionToDraw is Empty and we still have a buffer allocated. r=mattwoodrow
☠☠ backed out by 67ea2ad5b39e ☠ ☠
authorMason Chang <mchang@mozilla.com>
Mon, 10 Feb 2014 08:56:31 -0500
changeset 167857 68de70a3d9f8c2a5295708356ea8672dafa5dcd5
parent 167856 7b911962c1cec21c1841d443fa9506c972cb27b6
child 167858 64b55d215a6246a05445f44044b77a9e87f91a91
push id26190
push userryanvm@gmail.com
push dateMon, 10 Feb 2014 20:37:53 +0000
treeherdermozilla-central@07739c5c874f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs969591
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 969591 - Cleanup Thebes Layer if mRegionToDraw is Empty and we still have a buffer allocated. r=mattwoodrow
gfx/layers/RotatedBuffer.cpp
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -498,18 +498,26 @@ RotatedContentBuffer::BeginPaint(ThebesL
 
   result.mRegionToDraw.Sub(neededRegion, validRegion);
 
   // Do not modify result.mRegionToDraw or result.mContentType after this call.
   // Do not modify mBufferRect, mBufferRotation, or mDidSelfCopy,
   // or call CreateBuffer before this call.
   FinalizeFrame(result.mRegionToDraw);
 
-  if (result.mRegionToDraw.IsEmpty())
+  // Have some cases where the region to draw is empty,
+  // but the needed region is not empty, so we still need to allocate
+  // a clean buffer for those cases. If everything is empty, then clear out
+  // the buffers.
+  if (result.mRegionToDraw.IsEmpty() && canReuseBuffer) {
+    if (neededRegion.IsEmpty()) {
+      Clear();
+    }
     return result;
+  }
 
   nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
   RefPtr<DrawTarget> destDTBuffer;
   RefPtr<DrawTarget> destDTBufferOnWhite;
   uint32_t bufferFlags = canHaveRotation ? ALLOW_REPEAT : 0;
   if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
     bufferFlags |= BUFFER_COMPONENT_ALPHA;
   }