mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 861127, refactor ContentClientRemote::CreateBuffer. r=Bas
This commit is contained in:
parent
be9cbe79ed
commit
7e452fa8da
@ -104,10 +104,10 @@ ContentClientRemote::EndPaint()
|
||||
}
|
||||
}
|
||||
|
||||
TemporaryRef<DrawTarget>
|
||||
ContentClientRemote::CreateDTBuffer(ContentType aType,
|
||||
const nsIntRect& aRect,
|
||||
uint32_t aFlags)
|
||||
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?");
|
||||
@ -127,6 +127,14 @@ ContentClientRemote::CreateDTBuffer(ContentType aType,
|
||||
MOZ_ASSERT(IsSurfaceDescriptorValid(*mTextureClient->GetDescriptor()));
|
||||
|
||||
CreateFrontBufferAndNotify(aRect);
|
||||
}
|
||||
|
||||
TemporaryRef<DrawTarget>
|
||||
ContentClientRemote::CreateDTBuffer(ContentType aType,
|
||||
const nsIntRect& aRect,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
BuildTextureClient(aType, aRect, aFlags);
|
||||
|
||||
RefPtr<DrawTarget> ret = mTextureClient->LockDrawTarget();
|
||||
return ret.forget();
|
||||
@ -137,24 +145,7 @@ 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();
|
||||
}
|
||||
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);
|
||||
BuildTextureClient(aType, aRect, aFlags);
|
||||
|
||||
nsRefPtr<gfxASurface> ret = mTextureClient->LockSurface();
|
||||
return ret.forget();
|
||||
|
@ -215,6 +215,11 @@ protected:
|
||||
const nsIntRegion& aVisibleRegion,
|
||||
bool aDidSelfCopy);
|
||||
|
||||
// create and configure mTextureClient
|
||||
void BuildTextureClient(ContentType aType,
|
||||
const nsIntRect& aRect,
|
||||
uint32_t aFlags);
|
||||
|
||||
// Create the front buffer for the ContentClient/Host pair if necessary
|
||||
// and notify the compositor that we have created the buffer(s).
|
||||
virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user