Bug 874369 - Use normal memory instead of Shmem when only sharing between processes. r=Bas

This commit is contained in:
Matt Woodrow
2013-05-22 15:04:12 +08:00
parent 728d7ddf50
commit 7f17192cb8
7 changed files with 72 additions and 3 deletions

View File

@@ -32,10 +32,22 @@ ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfxIntSize& aSize,
ShadowLayerForwarder::PlatformOpenDescriptor(OpenMode aMode,
const SurfaceDescriptor& aSurface)
{
if (SurfaceDescriptor::TShmem != aSurface.type()) {
return nullptr;
if (aSurface.type() == SurfaceDescriptor::TShmem) {
return gfxSharedQuartzSurface::Open(aSurface.get_Shmem());
} else if (aSurface.type() == SurfaceDescriptor::TMemoryImage) {
const MemoryImage& image = aSurface.get_MemoryImage();
gfxASurface::gfxImageFormat format
= static_cast<gfxASurface::gfxImageFormat>(image.format());
nsRefPtr<gfxASurface> surf =
new gfxQuartzSurface((unsigned char*)image.data(),
image.size(),
image.stride(),
format);
return surf.forget();
}
return gfxSharedQuartzSurface::Open(aSurface.get_Shmem());
return nullptr;
}
/*static*/ bool