Bug 611799 Prefill newly created buffers with old content r=cjones a=blocking-fennec

This commit is contained in:
Benjamin Stover 2010-11-12 14:21:05 -08:00
Родитель 867fff1364
Коммит 0521600299
1 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@ -1412,8 +1412,9 @@ class BasicShadowableThebesLayer : public BasicThebesLayer,
typedef BasicThebesLayer Base;
public:
BasicShadowableThebesLayer(BasicShadowLayerManager* aManager) :
BasicThebesLayer(aManager)
BasicShadowableThebesLayer(BasicShadowLayerManager* aManager)
: BasicThebesLayer(aManager)
, mIsNewBuffer(false)
{
MOZ_COUNT_CTOR(BasicShadowableThebesLayer);
}
@ -1470,6 +1471,8 @@ private:
// copy of the descriptor here so that we can call
// DestroySharedSurface() on the descriptor.
SurfaceDescriptor mBackBuffer;
PRPackedBool mIsNewBuffer;
};
void
@ -1526,10 +1529,22 @@ BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext,
return;
}
nsIntRegion updatedRegion;
if (mIsNewBuffer) {
// A buffer reallocation clears both buffers. The front buffer has all the
// content by now, but the back buffer is still clear. Here, in effect, we
// are saying to copy all of the pixels of the front buffer to the back.
updatedRegion = mVisibleRegion;
mIsNewBuffer = false;
} else {
updatedRegion = aRegionToDraw;
}
NS_ABORT_IF_FALSE(IsSurfaceDescriptorValid(mBackBuffer),
"should have a back buffer by now");
BasicManager()->PaintedThebesBuffer(BasicManager()->Hold(this),
aRegionToDraw,
updatedRegion,
mBuffer.BufferRect(),
mBuffer.BufferRotation(),
mBackBuffer);
@ -1561,6 +1576,10 @@ BasicShadowableThebesLayer::CreateBuffer(Buffer::ContentType aType,
&mBackBuffer))
NS_RUNTIMEABORT("creating ThebesLayer 'back buffer' failed!");
NS_ABORT_IF_FALSE(!mIsNewBuffer,
"Bad! Did we create a buffer twice without painting?");
mIsNewBuffer = true;
BasicManager()->CreatedThebesBuffer(BasicManager()->Hold(this),
nsIntRegion(),
1.0, 1.0,