Remove the backend flag to TextureClient::CreateForDrawing. (bug 1183910 part 9, r=mattwoodrow)
This commit is contained in:
@@ -320,18 +320,30 @@ CreateBufferTextureClient(ISurfaceAllocator* aAllocator,
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
static inline gfx::BackendType
|
||||
BackendTypeForBackendSelector(BackendSelector aSelector)
|
||||
{
|
||||
switch (aSelector) {
|
||||
case BackendSelector::Canvas:
|
||||
return gfxPlatform::GetPlatform()->GetPreferredCanvasBackend();
|
||||
case BackendSelector::Content:
|
||||
return gfxPlatform::GetPlatform()->GetContentBackend();
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown backend selector");
|
||||
return gfx::BackendType::NONE;
|
||||
}
|
||||
};
|
||||
|
||||
// static
|
||||
already_AddRefed<TextureClient>
|
||||
TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2DBackend,
|
||||
BackendSelector aSelector,
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags aAllocFlags)
|
||||
{
|
||||
if (aMoz2DBackend == gfx::BackendType::NONE) {
|
||||
aMoz2DBackend = gfxPlatform::GetPlatform()->GetContentBackend();
|
||||
}
|
||||
gfx::BackendType moz2DBackend = BackendTypeForBackendSelector(aSelector);
|
||||
|
||||
RefPtr<TextureClient> texture;
|
||||
|
||||
@@ -342,15 +354,15 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
||||
#ifdef XP_WIN
|
||||
LayersBackend parentBackend = aAllocator->GetCompositorBackendType();
|
||||
if (parentBackend == LayersBackend::LAYERS_D3D11 &&
|
||||
((aMoz2DBackend == gfx::BackendType::DIRECT2D && Factory::GetDirect3D10Device()) ||
|
||||
(aMoz2DBackend == gfx::BackendType::DIRECT2D1_1 && Factory::GetDirect3D11Device())) &&
|
||||
(moz2DBackend == gfx::BackendType::DIRECT2D ||
|
||||
moz2DBackend == gfx::BackendType::DIRECT2D1_1) &&
|
||||
aSize.width <= maxTextureSize &&
|
||||
aSize.height <= maxTextureSize)
|
||||
{
|
||||
texture = new TextureClientD3D11(aAllocator, aFormat, aTextureFlags);
|
||||
}
|
||||
if (parentBackend == LayersBackend::LAYERS_D3D9 &&
|
||||
aMoz2DBackend == gfx::BackendType::CAIRO &&
|
||||
moz2DBackend == gfx::BackendType::CAIRO &&
|
||||
aAllocator->IsSameProcess() &&
|
||||
aSize.width <= maxTextureSize &&
|
||||
aSize.height <= maxTextureSize &&
|
||||
@@ -362,7 +374,7 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
||||
|
||||
if (!texture && aFormat == SurfaceFormat::B8G8R8X8 &&
|
||||
aAllocator->IsSameProcess() &&
|
||||
aMoz2DBackend == gfx::BackendType::CAIRO &&
|
||||
moz2DBackend == gfx::BackendType::CAIRO &&
|
||||
NS_IsMainThread()) {
|
||||
if (aAllocator->IsSameProcess()) {
|
||||
texture = new TextureClientMemoryDIB(aAllocator, aFormat, aTextureFlags);
|
||||
@@ -378,7 +390,7 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
||||
gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType();
|
||||
|
||||
if (parentBackend == LayersBackend::LAYERS_BASIC &&
|
||||
aMoz2DBackend == gfx::BackendType::CAIRO &&
|
||||
moz2DBackend == gfx::BackendType::CAIRO &&
|
||||
type == gfxSurfaceType::Xlib)
|
||||
{
|
||||
texture = new TextureClientX11(aAllocator, aFormat, aTextureFlags);
|
||||
@@ -399,7 +411,7 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
||||
// Don't allow Gralloc texture clients to exceed the maximum texture size.
|
||||
// BufferTextureClients have code to handle tiling the surface client-side.
|
||||
if (aSize.width <= maxTextureSize && aSize.height <= maxTextureSize) {
|
||||
texture = new GrallocTextureClientOGL(aAllocator, aFormat, aMoz2DBackend,
|
||||
texture = new GrallocTextureClientOGL(aAllocator, aFormat, moz2DBackend,
|
||||
aTextureFlags);
|
||||
}
|
||||
}
|
||||
@@ -420,7 +432,7 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
||||
}
|
||||
|
||||
// Can't do any better than a buffer texture client.
|
||||
texture = CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, aMoz2DBackend);
|
||||
texture = CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, moz2DBackend);
|
||||
|
||||
if (!texture->AllocateForSurface(aSize, aAllocFlags)) {
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user