void ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat, const IntRect& aRect, uint32_t aFlags) { // If we hit this assertion, then it might be due to an empty transaction // followed by a real transaction. Our buffers should be created (but not // painted in the empty transaction) and then painted (but not created) in the // real transaction. That is kind of fragile, and this assert will catch // circumstances where we screw that up, e.g., by unnecessarily recreating our // buffers. MOZ_ASSERT(!mIsNewBuffer, "Bad! Did we create a buffer twice without painting?"); mIsNewBuffer = true; DestroyBuffers(); mSurfaceFormat = aFormat; mSize = IntSize(aRect.width, aRect.height); mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags); if (aFlags & BUFFER_COMPONENT_ALPHA) { mTextureFlags |= TextureFlags::COMPONENT_ALPHA; } CreateBackBuffer(mBufferRect); }
void ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat, const nsIntRect& aRect, uint32_t aFlags) { // If we hit this assertion, then it might be due to an empty transaction // followed by a real transaction. Our buffers should be created (but not // painted in the empty transaction) and then painted (but not created) in the // real transaction. That is kind of fragile, and this assert will catch // circumstances where we screw that up, e.g., by unnecessarily recreating our // buffers. NS_ABORT_IF_FALSE(!mIsNewBuffer, "Bad! Did we create a buffer twice without painting?"); mIsNewBuffer = true; DestroyBuffers(); mSurfaceFormat = aFormat; mSize = gfx::IntSize(aRect.width, aRect.height); mTextureInfo.mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags); if (!CreateAndAllocateTextureClient(mTextureClient, TEXTURE_ON_BLACK) || !AddTextureClient(mTextureClient)) { AbortTextureClientCreation(); return; } if (aFlags & BUFFER_COMPONENT_ALPHA) { if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TEXTURE_ON_WHITE) || !AddTextureClient(mTextureClientOnWhite)) { AbortTextureClientCreation(); return; } mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA; } CreateFrontBuffer(aRect); }