Bug 603885, part 7: Remove front-buffer pre-fill code that is now subsumed by swap-and-readback (which also gets the pre-fill off the critical path for repainting). r=roc

This commit is contained in:
Chris Jones
2010-11-05 02:17:07 -05:00
parent 7c00c53ded
commit ce6d15dd64

View File

@@ -1471,11 +1471,6 @@ private:
// copy of the descriptor here so that we can call
// DestroySharedSurface() on the descriptor.
SurfaceDescriptor mBackBuffer;
// When we allocate a new front buffer, we keep a temporary record
// of it until reach PaintBuffer(). Then we pre-fill back->front
// and destroy our record.
SurfaceDescriptor mNewFrontBuffer;
nsIntSize mBufferSize;
};
void
@@ -1527,40 +1522,8 @@ BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext,
NS_ABORT_IF_FALSE(IsSurfaceDescriptorValid(mBackBuffer),
"should have a back buffer by now");
nsIntRegion updatedRegion = aRegionToDraw;
if (IsSurfaceDescriptorValid(mNewFrontBuffer)) {
// We just allocated a new buffer pair. We want to "pre-fill"
// the new front buffer by copying to it what we just painted
// into the back buffer. This starts off our Swap()s from a
// stable base: the first swap will return the same valid region
// as our new back buffer. Thereafter, we only need to
// invalidate what was painted into the back buffer.
nsRefPtr<gfxASurface> frontBuffer =
BasicManager()->OpenDescriptor(mNewFrontBuffer);
nsRefPtr<gfxASurface> backBuffer =
BasicManager()->OpenDescriptor(mBackBuffer);
nsRefPtr<gfxContext> ctx = new gfxContext(frontBuffer);
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->DrawSurface(backBuffer, backBuffer->GetSize());
BasicManager()->CreatedThebesBuffer(BasicManager()->Hold(this),
mValidRegion,
mXResolution,
mYResolution,
mBuffer.BufferRect(),
mNewFrontBuffer);
// Clear temporary record of new front buffer
mNewFrontBuffer = SurfaceDescriptor();
// And pretend that we didn't update anything, in order to
// stabilize the first swap.
updatedRegion.SetEmpty();
}
BasicManager()->PaintedThebesBuffer(BasicManager()->Hold(this),
updatedRegion,
aRegionToDraw,
mBuffer.BufferRect(),
mBuffer.BufferRotation(),
mBackBuffer);
@@ -1581,14 +1544,18 @@ BasicShadowableThebesLayer::CreateBuffer(Buffer::ContentType aType,
}
// XXX error handling
NS_ABORT_IF_FALSE(!IsSurfaceDescriptorValid(mNewFrontBuffer),
"Bad! Did we create a buffer twice without painting?");
SurfaceDescriptor tmpFront;
if (!BasicManager()->AllocDoubleBuffer(gfxIntSize(aSize.width, aSize.height),
aType,
&mNewFrontBuffer,
&tmpFront,
&mBackBuffer))
NS_RUNTIMEABORT("creating ThebesLayer 'back buffer' failed!");
mBufferSize = aSize;
BasicManager()->CreatedThebesBuffer(BasicManager()->Hold(this),
nsIntRegion(),
1.0, 1.0,
nsIntRect(),
tmpFront);
return BasicManager()->OpenDescriptor(mBackBuffer);
}