Bug 777194. Part 2: Remove RETENTION_THRESHOLD. FrameLayerBuilder limits the complexity of visible regions anyway. r=bas
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 17 Aug 2012 11:38:59 +1200
changeset 107470 89003d5bfa07f7c3604c1a62e8b2974d439a7a10
parent 107469 22a46f5dca2be1fb16eca99bc251740c86ff781b
child 107471 2b2e43e83d0fb836cb5aca91905e5702b5ea7854
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersbas
bugs777194
milestone18.0a1
Bug 777194. Part 2: Remove RETENTION_THRESHOLD. FrameLayerBuilder limits the complexity of visible regions anyway. r=bas
gfx/layers/d3d10/ThebesLayerD3D10.cpp
--- a/gfx/layers/d3d10/ThebesLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ThebesLayerD3D10.cpp
@@ -37,58 +37,48 @@ ThebesLayerD3D10::ThebesLayerD3D10(Layer
 {
   mImplData = static_cast<LayerD3D10*>(this);
 }
 
 ThebesLayerD3D10::~ThebesLayerD3D10()
 {
 }
 
-/**
- * Retention threshold - amount of pixels intersection required to enable
- * layer content retention. This is a guesstimate. Profiling could be done to
- * figure out the optimal threshold.
- */
-#define RETENTION_THRESHOLD 16384
-
 void
-
 ThebesLayerD3D10::InvalidateRegion(const nsIntRegion &aRegion)
 {
   mValidRegion.Sub(mValidRegion, aRegion);
 }
 
 void ThebesLayerD3D10::CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset,
                                   ID3D10Texture2D* aDest, const nsIntPoint &aDestOffset,
                                   const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion)
 {
   nsIntRegion retainedRegion;
   nsIntRegionRectIterator iter(aCopyRegion);
   const nsIntRect *r;
   while ((r = iter.Next())) {
-    if (r->width * r->height > RETENTION_THRESHOLD) {
-      // Calculate the retained rectangle's position on the old and the new
-      // surface.
-      D3D10_BOX box;
-      box.left = r->x - aSrcOffset.x;
-      box.top = r->y - aSrcOffset.y;
-      box.right = box.left + r->width;
-      box.bottom = box.top + r->height;
-      box.back = 1;
-      box.front = 0;
+    // Calculate the retained rectangle's position on the old and the new
+    // surface.
+    D3D10_BOX box;
+    box.left = r->x - aSrcOffset.x;
+    box.top = r->y - aSrcOffset.y;
+    box.right = box.left + r->width;
+    box.bottom = box.top + r->height;
+    box.back = 1;
+    box.front = 0;
 
-      device()->CopySubresourceRegion(aDest, 0,
-                                      r->x - aDestOffset.x,
-                                      r->y - aDestOffset.y,
-                                      0,
-                                      aSrc, 0,
-                                      &box);
+    device()->CopySubresourceRegion(aDest, 0,
+                                    r->x - aDestOffset.x,
+                                    r->y - aDestOffset.y,
+                                    0,
+                                    aSrc, 0,
+                                    &box);
 
-      retainedRegion.Or(retainedRegion, *r);
-    }
+    retainedRegion.Or(retainedRegion, *r);
   }
 
   // Areas which were valid and were retained are still valid
   aValidRegion->And(*aValidRegion, retainedRegion);  
 }
 
 void
 ThebesLayerD3D10::RenderLayer()
@@ -214,18 +204,17 @@ ThebesLayerD3D10::Validate(ReadbackProce
       nsIntRect largeRect = retainRegion.GetLargestRectangle();
 
       // If we had no hardware texture before, or have no retained area larger than
       // the retention threshold, we're not retaining and are done here.
       // If our texture creation failed this can mean a device reset is pending
       // and we should silently ignore the failure. In the future when device
       // failures are properly handled we should test for the type of failure
       // and gracefully handle different failures. See bug 569081.
-      if (!oldTexture || !mTexture ||
-          largeRect.width * largeRect.height < RETENTION_THRESHOLD) {
+      if (!oldTexture || !mTexture) {
         mValidRegion.SetEmpty();
       } else {
         CopyRegion(oldTexture, mTextureRect.TopLeft(),
                    mTexture, newTextureRect.TopLeft(),
                    retainRegion, &mValidRegion);
         if (oldTextureOnWhite) {
           CopyRegion(oldTextureOnWhite, mTextureRect.TopLeft(),
                      mTextureOnWhite, newTextureRect.TopLeft(),
@@ -432,17 +421,17 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion
     context = new gfxContext(destinationSurface);
   }
 
   nsIntRegionRectIterator iter(aRegion);
   context->Translate(gfxPoint(-visibleRect.x, -visibleRect.y));
   context->NewPath();
   const nsIntRect *iterRect;
   while ((iterRect = iter.Next())) {
-    context->Rectangle(gfxRect(iterRect->x, iterRect->y, iterRect->width, iterRect->height));      
+    context->Rectangle(gfxRect(iterRect->x, iterRect->y, iterRect->width, iterRect->height));
     if (mDrawTarget && aMode == SURFACE_SINGLE_CHANNEL_ALPHA) {
       mDrawTarget->ClearRect(Rect(iterRect->x, iterRect->y, iterRect->width, iterRect->height));
     }
   }
   context->Clip();
 
   if (!mDrawTarget && aMode == SURFACE_SINGLE_CHANNEL_ALPHA) {
     context->SetOperator(gfxContext::OPERATOR_CLEAR);