author | Robert O'Callahan <robert@ocallahan.org> |
Fri, 17 Aug 2012 11:38:59 +1200 | |
changeset 107341 | 89003d5bfa07f7c3604c1a62e8b2974d439a7a10 |
parent 107340 | 22a46f5dca2be1fb16eca99bc251740c86ff781b |
child 107342 | 2b2e43e83d0fb836cb5aca91905e5702b5ea7854 |
push id | 14987 |
push user | rocallahan@mozilla.com |
push date | Tue, 18 Sep 2012 09:34:32 +0000 |
treeherder | mozilla-inbound@be9f5e549658 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bas |
bugs | 777194 |
milestone | 18.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
|
--- 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);