зеркало из https://github.com/mozilla/gecko-dev.git
Bug 784244: We really, seriously, can only let the BufferTracker take care of our required AutoOpenSurfaces. r=roc
This commit is contained in:
Родитель
a411005953
Коммит
5ac891e04e
|
@ -259,6 +259,8 @@ struct NS_STACK_CLASS AutoBufferTracker {
|
|||
// they were constructed.
|
||||
}
|
||||
|
||||
gfxASurface* GetInitialBuffer() { return mInitialBuffer.ref().Get(); }
|
||||
|
||||
gfxASurface*
|
||||
CreatedBuffer(const SurfaceDescriptor& aDescriptor) {
|
||||
Maybe<AutoOpenSurface>* surface = mNewBuffers.AppendElement();
|
||||
|
@ -267,7 +269,7 @@ struct NS_STACK_CLASS AutoBufferTracker {
|
|||
}
|
||||
|
||||
Maybe<AutoOpenSurface> mInitialBuffer;
|
||||
nsAutoTArray<Maybe<AutoOpenSurface>, 2> mNewBuffers;
|
||||
nsAutoTArray<Maybe<AutoOpenSurface>, 3> mNewBuffers;
|
||||
BasicShadowableThebesLayer* mLayer;
|
||||
|
||||
private:
|
||||
|
@ -328,20 +330,18 @@ BasicShadowableThebesLayer::SyncFrontBufferToBackBuffer()
|
|||
// that buffer when appropriate.
|
||||
MOZ_ASSERT(mBufferTracker);
|
||||
|
||||
gfxASurface* backBuffer = mBuffer.GetBuffer();
|
||||
nsRefPtr<gfxASurface> backBuffer = mBuffer.GetBuffer();
|
||||
if (!IsSurfaceDescriptorValid(mBackBuffer)) {
|
||||
MOZ_ASSERT(!backBuffer);
|
||||
MOZ_ASSERT(mROFrontBuffer.type() == OptionalThebesBuffer::TThebesBuffer);
|
||||
const ThebesBuffer roFront = mROFrontBuffer.get_ThebesBuffer();
|
||||
AutoOpenSurface roFrontBuffer(OPEN_READ_ONLY, roFront.buffer());
|
||||
AllocBackBuffer(roFrontBuffer.ContentType(), roFrontBuffer.Size());
|
||||
backBuffer = CreateBuffer(roFrontBuffer.ContentType(), roFrontBuffer.Size());
|
||||
}
|
||||
mFrontAndBackBufferDiffer = false;
|
||||
|
||||
Maybe<AutoOpenSurface> autoBackBuffer;
|
||||
if (!backBuffer) {
|
||||
autoBackBuffer.construct(OPEN_READ_WRITE, mBackBuffer);
|
||||
backBuffer = autoBackBuffer.ref().Get();
|
||||
backBuffer = mBufferTracker->GetInitialBuffer();
|
||||
}
|
||||
|
||||
if (OptionalThebesBuffer::Tnull_t == mROFrontBuffer.type()) {
|
||||
|
@ -416,23 +416,6 @@ BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext,
|
|||
mBackBuffer);
|
||||
}
|
||||
|
||||
void
|
||||
BasicShadowableThebesLayer::AllocBackBuffer(Buffer::ContentType aType,
|
||||
const nsIntSize& aSize)
|
||||
{
|
||||
// This function may *not* open the buffer it allocates.
|
||||
if (!BasicManager()->AllocBuffer(gfxIntSize(aSize.width, aSize.height),
|
||||
aType,
|
||||
&mBackBuffer)) {
|
||||
enum { buflen = 256 };
|
||||
char buf[buflen];
|
||||
PR_snprintf(buf, buflen,
|
||||
"creating ThebesLayer 'back buffer' failed! width=%d, height=%d, type=%x",
|
||||
aSize.width, aSize.height, int(aType));
|
||||
NS_RUNTIMEABORT(buf);
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
BasicShadowableThebesLayer::CreateBuffer(Buffer::ContentType aType,
|
||||
const nsIntSize& aSize)
|
||||
|
@ -451,7 +434,16 @@ BasicShadowableThebesLayer::CreateBuffer(Buffer::ContentType aType,
|
|||
mBackBuffer = SurfaceDescriptor();
|
||||
}
|
||||
|
||||
AllocBackBuffer(aType, aSize);
|
||||
if (!BasicManager()->AllocBuffer(gfxIntSize(aSize.width, aSize.height),
|
||||
aType,
|
||||
&mBackBuffer)) {
|
||||
enum { buflen = 256 };
|
||||
char buf[buflen];
|
||||
PR_snprintf(buf, buflen,
|
||||
"creating ThebesLayer 'back buffer' failed! width=%d, height=%d, type=%x",
|
||||
aSize.width, aSize.height, int(aType));
|
||||
NS_RUNTIMEABORT(buf);
|
||||
}
|
||||
|
||||
NS_ABORT_IF_FALSE(!mIsNewBuffer,
|
||||
"Bad! Did we create a buffer twice without painting?");
|
||||
|
|
|
@ -167,10 +167,6 @@ private:
|
|||
LayerManager::DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData) MOZ_OVERRIDE;
|
||||
|
||||
// This function may *not* open the buffer it allocates.
|
||||
void
|
||||
AllocBackBuffer(Buffer::ContentType aType, const nsIntSize& aSize);
|
||||
|
||||
virtual already_AddRefed<gfxASurface>
|
||||
CreateBuffer(Buffer::ContentType aType, const nsIntSize& aSize) MOZ_OVERRIDE;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче