Bug 1040028 - Create and allocate in one step when we used to call CreateBufferTextureClient and CreateTextureClientForDrawing. r=sotaro
This commit is contained in:
@@ -229,6 +229,25 @@ DisableGralloc(SurfaceFormat aFormat, const gfx::IntSize& aSizeHint)
|
||||
}
|
||||
#endif
|
||||
|
||||
static
|
||||
TemporaryRef<BufferTextureClient>
|
||||
CreateBufferTextureClient(ISurfaceAllocator* aAllocator,
|
||||
SurfaceFormat aFormat,
|
||||
TextureFlags aTextureFlags,
|
||||
gfx::BackendType aMoz2DBackend)
|
||||
{
|
||||
if (aAllocator->IsSameProcess()) {
|
||||
RefPtr<BufferTextureClient> result = new MemoryTextureClient(aAllocator, aFormat,
|
||||
aMoz2DBackend,
|
||||
aTextureFlags);
|
||||
return result.forget();
|
||||
}
|
||||
RefPtr<BufferTextureClient> result = new ShmemTextureClient(aAllocator, aFormat,
|
||||
aMoz2DBackend,
|
||||
aTextureFlags);
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
static
|
||||
TemporaryRef<TextureClient>
|
||||
CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
|
||||
@@ -313,7 +332,7 @@ CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
|
||||
|
||||
// Can't do any better than a buffer texture client.
|
||||
if (!result) {
|
||||
result = TextureClient::CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, aMoz2DBackend);
|
||||
result = CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, aMoz2DBackend);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!result || result->CanExposeDrawTarget(), "texture cannot expose a DrawTarget?");
|
||||
@@ -387,24 +406,29 @@ TextureClient::CreateForYCbCr(ISurfaceAllocator* aAllocator,
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
TemporaryRef<BufferTextureClient>
|
||||
TextureClient::CreateBufferTextureClient(ISurfaceAllocator* aAllocator,
|
||||
SurfaceFormat aFormat,
|
||||
TextureFlags aTextureFlags,
|
||||
gfx::BackendType aMoz2DBackend)
|
||||
TextureClient::CreateWithBufferSize(ISurfaceAllocator* aAllocator,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
size_t aSize,
|
||||
TextureFlags aTextureFlags)
|
||||
{
|
||||
RefPtr<BufferTextureClient> texture;
|
||||
if (aAllocator->IsSameProcess()) {
|
||||
RefPtr<BufferTextureClient> result = new MemoryTextureClient(aAllocator, aFormat,
|
||||
aMoz2DBackend,
|
||||
aTextureFlags);
|
||||
return result.forget();
|
||||
texture = new MemoryTextureClient(aAllocator, gfx::SurfaceFormat::YUV,
|
||||
gfx::BackendType::NONE,
|
||||
aTextureFlags);
|
||||
} else {
|
||||
texture = new ShmemTextureClient(aAllocator, gfx::SurfaceFormat::YUV,
|
||||
gfx::BackendType::NONE,
|
||||
aTextureFlags);
|
||||
}
|
||||
RefPtr<BufferTextureClient> result = new ShmemTextureClient(aAllocator, aFormat,
|
||||
aMoz2DBackend,
|
||||
aTextureFlags);
|
||||
return result.forget();
|
||||
|
||||
if (!texture->Allocate(aSize)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
TextureClient::TextureClient(TextureFlags aFlags)
|
||||
|
||||
Reference in New Issue
Block a user