Use a rect instead of a region for UpdateDestinationFrom (bug 1409871 part 15, r=nical) draft
authorRyan Hunt <rhunt@eqrion.net>
Wed, 18 Oct 2017 14:35:18 -0400
changeset 684137 ef30336e2eb50f562f623f5c4120f76b70c373b5
parent 684136 69811395655abf4799b48ce99fda663e10e36a1c
child 684138 b6dafe25315d42b6b556c0dd75f46120b65978ad
push id85567
push userbmo:rhunt@eqrion.net
push dateFri, 20 Oct 2017 22:13:22 +0000
reviewersnical
bugs1409871
milestone58.0a1
Use a rect instead of a region for UpdateDestinationFrom (bug 1409871 part 15, r=nical) UpdateDestinationFrom actually only uses a rect, so it's best to not be misleading and force the clients of it to do the conversion. MozReview-Commit-ID: EsUv3apqnku
gfx/layers/RotatedBuffer.cpp
gfx/layers/RotatedBuffer.h
gfx/layers/client/ContentClient.cpp
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -235,21 +235,21 @@ RotatedBuffer::DrawTo(PaintedLayer* aLay
   DrawBufferWithRotation(aTarget, BUFFER_BLACK, aOpacity, aOp, aMask, aMaskTransform);
   if (clipped) {
     aTarget->PopClip();
   }
 }
 
 void
 RotatedBuffer::UpdateDestinationFrom(const RotatedBuffer& aSource,
-                                     const nsIntRegion& aUpdateRegion)
+                                     const gfx::IntRect& aUpdateRect)
 {
   DrawIterator iter;
   while (DrawTarget* destDT =
-    BorrowDrawTargetForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_BLACK, &iter)) {
+    BorrowDrawTargetForQuadrantUpdate(aUpdateRect, BUFFER_BLACK, &iter)) {
     bool isClippingCheap = IsClippingCheap(destDT, iter.mDrawRegion);
     if (isClippingCheap) {
       gfxUtils::ClipToRegion(destDT, iter.mDrawRegion);
     }
 
     aSource.DrawBufferWithRotation(destDT, BUFFER_BLACK, 1.0, CompositionOp::OP_SOURCE);
     if (isClippingCheap) {
       destDT->PopClip();
@@ -257,17 +257,17 @@ RotatedBuffer::UpdateDestinationFrom(con
     // Flush the destination before the sources become inaccessible (Unlock).
     destDT->Flush();
     ReturnDrawTarget(destDT);
   }
 
   if (aSource.HaveBufferOnWhite() && HaveBufferOnWhite()) {
     DrawIterator whiteIter;
     while (DrawTarget* destDT =
-      BorrowDrawTargetForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_WHITE, &whiteIter)) {
+      BorrowDrawTargetForQuadrantUpdate(aUpdateRect, BUFFER_WHITE, &whiteIter)) {
       bool isClippingCheap = IsClippingCheap(destDT, whiteIter.mDrawRegion);
       if (isClippingCheap) {
         gfxUtils::ClipToRegion(destDT, whiteIter.mDrawRegion);
       }
 
       aSource.DrawBufferWithRotation(destDT, BUFFER_WHITE, 1.0, CompositionOp::OP_SOURCE);
       if (isClippingCheap) {
         destDT->PopClip();
--- a/gfx/layers/RotatedBuffer.h
+++ b/gfx/layers/RotatedBuffer.h
@@ -113,17 +113,17 @@ public:
               gfx::SourceSurface* aMask,
               const gfx::Matrix* aMaskTransform);
 
   /**
    * Update the specified region of this rotated buffer with the contents
    * of a source rotated buffer.
    */
   void UpdateDestinationFrom(const RotatedBuffer& aSource,
-                             const nsIntRegion& aUpdateRegion);
+                             const gfx::IntRect& aUpdateRect);
 
   /**
    * A draw iterator is used to keep track of which quadrant of a rotated
    * buffer and region of that quadrant is being updated.
    */
   struct DrawIterator {
     friend class RotatedBuffer;
     DrawIterator()
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -210,17 +210,17 @@ ContentClient::BeginPaintBuffer(PaintedL
   }
 
   NS_ASSERTION(!(aFlags & PAINT_WILL_RESAMPLE) || dest.mBufferRect == dest.mNeededRegion.GetBounds(),
                "If we're resampling, we need to validate the entire buffer");
 
   // If needed, copy the old buffer over to the new one
   if (newBuffer) {
     if (mBuffer) {
-      newBuffer->UpdateDestinationFrom(*mBuffer, nsIntRegion(newBuffer->BufferRect()));
+      newBuffer->UpdateDestinationFrom(*mBuffer, newBuffer->BufferRect());
     }
 
     // Ensure our reference to the front buffer is released
     // as well as the old back buffer.
     Clear();
 
     mBuffer = newBuffer;
   }
@@ -927,17 +927,17 @@ ContentClientDoubleBuffered::FinalizeFra
     return;
   }
 
   if (!mBuffer) {
     return;
   }
 
   if (mFrontBuffer->Lock(OpenMode::OPEN_READ_ONLY)) {
-    mBuffer->UpdateDestinationFrom(*mFrontBuffer, updateRegion);
+    mBuffer->UpdateDestinationFrom(*mFrontBuffer, updateRegion.GetBounds());
     mFrontBuffer->Unlock();
   }
 }
 
 void
 ContentClientDoubleBuffered::EnsureBackBufferIfFrontBuffer()
 {
   if (!mBuffer && mFrontBuffer) {