зеркало из 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.
|
// they were constructed.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gfxASurface* GetInitialBuffer() { return mInitialBuffer.ref().Get(); }
|
||||||
|
|
||||||
gfxASurface*
|
gfxASurface*
|
||||||
CreatedBuffer(const SurfaceDescriptor& aDescriptor) {
|
CreatedBuffer(const SurfaceDescriptor& aDescriptor) {
|
||||||
Maybe<AutoOpenSurface>* surface = mNewBuffers.AppendElement();
|
Maybe<AutoOpenSurface>* surface = mNewBuffers.AppendElement();
|
||||||
|
@ -267,7 +269,7 @@ struct NS_STACK_CLASS AutoBufferTracker {
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<AutoOpenSurface> mInitialBuffer;
|
Maybe<AutoOpenSurface> mInitialBuffer;
|
||||||
nsAutoTArray<Maybe<AutoOpenSurface>, 2> mNewBuffers;
|
nsAutoTArray<Maybe<AutoOpenSurface>, 3> mNewBuffers;
|
||||||
BasicShadowableThebesLayer* mLayer;
|
BasicShadowableThebesLayer* mLayer;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -328,20 +330,18 @@ BasicShadowableThebesLayer::SyncFrontBufferToBackBuffer()
|
||||||
// that buffer when appropriate.
|
// that buffer when appropriate.
|
||||||
MOZ_ASSERT(mBufferTracker);
|
MOZ_ASSERT(mBufferTracker);
|
||||||
|
|
||||||
gfxASurface* backBuffer = mBuffer.GetBuffer();
|
nsRefPtr<gfxASurface> backBuffer = mBuffer.GetBuffer();
|
||||||
if (!IsSurfaceDescriptorValid(mBackBuffer)) {
|
if (!IsSurfaceDescriptorValid(mBackBuffer)) {
|
||||||
MOZ_ASSERT(!backBuffer);
|
MOZ_ASSERT(!backBuffer);
|
||||||
MOZ_ASSERT(mROFrontBuffer.type() == OptionalThebesBuffer::TThebesBuffer);
|
MOZ_ASSERT(mROFrontBuffer.type() == OptionalThebesBuffer::TThebesBuffer);
|
||||||
const ThebesBuffer roFront = mROFrontBuffer.get_ThebesBuffer();
|
const ThebesBuffer roFront = mROFrontBuffer.get_ThebesBuffer();
|
||||||
AutoOpenSurface roFrontBuffer(OPEN_READ_ONLY, roFront.buffer());
|
AutoOpenSurface roFrontBuffer(OPEN_READ_ONLY, roFront.buffer());
|
||||||
AllocBackBuffer(roFrontBuffer.ContentType(), roFrontBuffer.Size());
|
backBuffer = CreateBuffer(roFrontBuffer.ContentType(), roFrontBuffer.Size());
|
||||||
}
|
}
|
||||||
mFrontAndBackBufferDiffer = false;
|
mFrontAndBackBufferDiffer = false;
|
||||||
|
|
||||||
Maybe<AutoOpenSurface> autoBackBuffer;
|
|
||||||
if (!backBuffer) {
|
if (!backBuffer) {
|
||||||
autoBackBuffer.construct(OPEN_READ_WRITE, mBackBuffer);
|
backBuffer = mBufferTracker->GetInitialBuffer();
|
||||||
backBuffer = autoBackBuffer.ref().Get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OptionalThebesBuffer::Tnull_t == mROFrontBuffer.type()) {
|
if (OptionalThebesBuffer::Tnull_t == mROFrontBuffer.type()) {
|
||||||
|
@ -416,23 +416,6 @@ BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext,
|
||||||
mBackBuffer);
|
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>
|
already_AddRefed<gfxASurface>
|
||||||
BasicShadowableThebesLayer::CreateBuffer(Buffer::ContentType aType,
|
BasicShadowableThebesLayer::CreateBuffer(Buffer::ContentType aType,
|
||||||
const nsIntSize& aSize)
|
const nsIntSize& aSize)
|
||||||
|
@ -451,7 +434,16 @@ BasicShadowableThebesLayer::CreateBuffer(Buffer::ContentType aType,
|
||||||
mBackBuffer = SurfaceDescriptor();
|
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,
|
NS_ABORT_IF_FALSE(!mIsNewBuffer,
|
||||||
"Bad! Did we create a buffer twice without painting?");
|
"Bad! Did we create a buffer twice without painting?");
|
||||||
|
|
|
@ -167,10 +167,6 @@ private:
|
||||||
LayerManager::DrawThebesLayerCallback aCallback,
|
LayerManager::DrawThebesLayerCallback aCallback,
|
||||||
void* aCallbackData) MOZ_OVERRIDE;
|
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>
|
virtual already_AddRefed<gfxASurface>
|
||||||
CreateBuffer(Buffer::ContentType aType, const nsIntSize& aSize) MOZ_OVERRIDE;
|
CreateBuffer(Buffer::ContentType aType, const nsIntSize& aSize) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче