already_AddRefed<gfxASurface> ContentClientRemote::CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags) { NS_ABORT_IF_FALSE(!mIsNewBuffer, "Bad! Did we create a buffer twice without painting?"); mIsNewBuffer = true; if (mTextureClient) { mOldTextures.AppendElement(mTextureClient); DestroyBuffers(); } mTextureClient = CreateTextureClient(TEXTURE_CONTENT, aFlags | HostRelease); mContentType = aType; mSize = gfx::IntSize(aRect.width, aRect.height); mTextureClient->EnsureAllocated(mSize, mContentType); // note that LockSurfaceDescriptor doesn't actually lock anything MOZ_ASSERT(IsSurfaceDescriptorValid(*mTextureClient->LockSurfaceDescriptor())); CreateFrontBufferAndNotify(aRect, aFlags | HostRelease); nsRefPtr<gfxASurface> ret = mTextureClient->LockSurface(); return ret.forget(); }
void ContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType aType, const nsIntRect& aRect, uint32_t aFlags) { NS_ABORT_IF_FALSE(!mIsNewBuffer, "Bad! Did we create a buffer twice without painting?"); mIsNewBuffer = true; if (mDeprecatedTextureClient) { mOldTextures.AppendElement(mDeprecatedTextureClient); if (mDeprecatedTextureClientOnWhite) { mOldTextures.AppendElement(mDeprecatedTextureClientOnWhite); } DestroyBuffers(); } mContentType = aType; mSize = gfx::IntSize(aRect.width, aRect.height); mTextureInfo.mTextureFlags = aFlags | TEXTURE_DEALLOCATE_HOST; if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClient)) { return; } if (aFlags & BUFFER_COMPONENT_ALPHA) { if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClientOnWhite)) { return; } mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA; } CreateFrontBufferAndNotify(aRect); }
void ContentClientRemote::BuildTextureClient(ContentType aType, const nsIntRect& aRect, uint32_t aFlags) { NS_ABORT_IF_FALSE(!mIsNewBuffer, "Bad! Did we create a buffer twice without painting?"); mIsNewBuffer = true; if (mTextureClient) { mOldTextures.AppendElement(mTextureClient); DestroyBuffers(); } mTextureInfo.mTextureFlags = aFlags | HostRelease; mTextureClient = CreateTextureClient(TEXTURE_CONTENT); mContentType = aType; mSize = gfx::IntSize(aRect.width, aRect.height); mTextureClient->EnsureAllocated(mSize, mContentType); MOZ_ASSERT(IsSurfaceDescriptorValid(*mTextureClient->GetDescriptor())); CreateFrontBufferAndNotify(aRect); }