Backed out changeset 0569a8a2f83d (bug 958727) for causing performance regressions.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 26 Feb 2014 20:48:41 -0500
changeset 171251 82a063f4ae3960d661a4a8cd455a618eeb55dece
parent 171250 dfcedba046649038e8603ee897ce1911b2db68a4
child 171252 6c80739590b61320c052c00bf94b87b815caef87
child 171304 d0844474a0f280848ee30ea085e022c81ac38ed2
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs958727
milestone30.0a1
backs out0569a8a2f83d7d490bc5c9c06da06abb516686bc
Backed out changeset 0569a8a2f83d (bug 958727) for causing performance regressions.
gfx/layers/RotatedBuffer.cpp
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -296,27 +296,19 @@ RotatedContentBuffer::BufferContentType(
     return ContentForFormat(format);
   }
   return gfxContentType::SENTINEL;
 }
 
 bool
 RotatedContentBuffer::BufferSizeOkFor(const nsIntSize& aSize)
 {
-  if (aSize == mBufferRect.Size()) {
-    return true;
-  }
-
-  if (SizedToVisibleBounds != mBufferSizePolicy &&
-      aSize < mBufferRect.Size()) {
-    return (aSize.width * 2 > mBufferRect.width) &&
-           (aSize.height * 2 > mBufferRect.height);
-  }
-
-  return false;
+  return (aSize == mBufferRect.Size() ||
+          (SizedToVisibleBounds != mBufferSizePolicy &&
+           aSize < mBufferRect.Size()));
 }
 
 bool
 RotatedContentBuffer::EnsureBuffer()
 {
   NS_ASSERTION(!mLoanedDrawTarget, "Loaned draw target must be returned");
   if (!mDTBuffer) {
     if (mDeprecatedBufferProvider) {
@@ -506,19 +498,18 @@ 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()) {
+  if (result.mRegionToDraw.IsEmpty())
     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;
   }
@@ -618,17 +609,17 @@ RotatedContentBuffer::BeginPaint(ThebesL
     } else {
       // No pixels are going to be kept. The whole visible region
       // will be redrawn, so we don't need to copy anything, so we don't
       // set destBuffer.
       mBufferRect = destBufferRect;
       mBufferRotation = nsIntPoint(0,0);
     }
   } else {
-    // The buffer's not big enough or the buffer needs to shrink, so allocate a new one
+    // The buffer's not big enough, so allocate a new one
     CreateBuffer(result.mContentType, destBufferRect, bufferFlags,
                  &destDTBuffer, &destDTBufferOnWhite);
     if (!destDTBuffer) {
       return result;
     }
   }
 
   NS_ASSERTION(!(aFlags & PAINT_WILL_RESAMPLE) || destBufferRect == neededRegion.GetBounds(),