Bug 1008211 - Don't use CreateBufferTextureClient with CanvasClient2D on Windows. r=bas

This commit is contained in:
Nicolas Silva 2014-06-10 14:02:16 -04:00
Родитель 8af5e719cd
Коммит 25092b570f
2 изменённых файлов: 29 добавлений и 11 удалений

Просмотреть файл

@ -74,17 +74,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
}
gfx::SurfaceFormat surfaceFormat = gfx::ImageFormatToSurfaceFormat(format);
if (aLayer->IsGLLayer()) {
// 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.
mBuffer = CreateBufferTextureClient(surfaceFormat, flags, BackendType::CAIRO);
} else {
// XXX - We should use CreateTextureClientForDrawing, but we first need
// to use double buffering.
mBuffer = CreateBufferTextureClient(surfaceFormat, flags,
gfxPlatform::GetPlatform()->GetPreferredCanvasBackend());
}
mBuffer = CreateTextureClientForCanvas(surfaceFormat, aSize, flags, aLayer);
MOZ_ASSERT(mBuffer->CanExposeDrawTarget());
mBuffer->AllocateForSurface(aSize);
@ -119,6 +109,29 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
}
}
TemporaryRef<TextureClient>
CanvasClient2D::CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
TextureFlags aFlags,
ClientCanvasLayer* aLayer)
{
if (aLayer->IsGLLayer()) {
// 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);
}
gfx::BackendType backend = gfxPlatform::GetPlatform()->GetPreferredCanvasBackend();
#ifdef XP_WIN
return CreateTextureClientForDrawing(aFormat, aFlags, backend, aSize);
#else
// XXX - We should use CreateTextureClientForDrawing, but we first need
// to use double buffering.
return CreateBufferTextureClient(aFormat, aFlags, backend);
#endif
}
CanvasClientSurfaceStream::CanvasClientSurfaceStream(CompositableForwarder* aLayerForwarder,
TextureFlags aFlags)
: CanvasClient(aLayerForwarder, aFlags)

Просмотреть файл

@ -101,6 +101,11 @@ public:
}
private:
TemporaryRef<TextureClient> CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
TextureFlags aFlags,
ClientCanvasLayer* aLayer);
RefPtr<TextureClient> mBuffer;
};