Bug 1027601 - Create and allocate TextureClients in a single step in some cases. r=sotaro

This commit is contained in:
Nicolas Silva
2014-07-09 11:59:49 +02:00
parent d2b3407dac
commit 2b5d60e4a8
11 changed files with 129 additions and 69 deletions

View File

@@ -74,6 +74,10 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
gfx::SurfaceFormat surfaceFormat = gfx::ImageFormatToSurfaceFormat(format);
mBuffer = CreateTextureClientForCanvas(surfaceFormat, aSize, flags, aLayer);
if (!mBuffer) {
NS_WARNING("Failed to allocate the TextureClient");
return;
}
MOZ_ASSERT(mBuffer->CanExposeDrawTarget());
mBuffer->AllocateForSurface(aSize);
@@ -118,16 +122,20 @@ CanvasClient2D::CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
// We want a cairo backend here as we don't want to be copying into
// an accelerated backend and we like LockBits to work. This is currently
// the most effective way to make this work.
return CreateBufferTextureClient(aFormat, aFlags, BackendType::CAIRO);
return TextureClient::CreateForRawBufferAccess(GetForwarder(),
aFormat, aSize, BackendType::CAIRO,
mTextureInfo.mTextureFlags | aFlags);
}
gfx::BackendType backend = gfxPlatform::GetPlatform()->GetPreferredCanvasBackend();
#ifdef XP_WIN
return CreateTextureClientForDrawing(aFormat, aFlags, backend, aSize);
return CreateTextureClientForDrawing(aFormat, aSize, backend, aFlags);
#else
// XXX - We should use CreateTextureClientForDrawing, but we first need
// to use double buffering.
return CreateBufferTextureClient(aFormat, aFlags, backend);
return TextureClient::CreateForRawBufferAccess(GetForwarder(),
aFormat, aSize, BackendType::CAIRO,
mTextureInfo.mTextureFlags | aFlags);
#endif
}