gecko/gfx/thebes/gfxReusableSharedImageSurfaceWrapper.h

64 lines
1.8 KiB
C
Raw Normal View History

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GFXSHMCOWSURFACEWRAPPER
#define GFXSHMCOWSURFACEWRAPPER
#include "gfxReusableSurfaceWrapper.h"
#include "mozilla/RefPtr.h"
class gfxSharedImageSurface;
namespace mozilla {
namespace ipc {
class Shmem;
}
namespace layers {
class ISurfaceAllocator;
}
}
/**
* A cross-process capable implementation of gfxReusableSurfaceWrapper based
* on gfxSharedImageSurface.
*/
class gfxReusableSharedImageSurfaceWrapper : public gfxReusableSurfaceWrapper {
public:
gfxReusableSharedImageSurfaceWrapper(mozilla::layers::ISurfaceAllocator* aAllocator,
gfxSharedImageSurface* aSurface);
protected:
~gfxReusableSharedImageSurfaceWrapper();
public:
const unsigned char* GetReadOnlyData() const MOZ_OVERRIDE;
Bug 913872 - Take nested enums out of gfxASurface - 1/3 : automatic changes - r=jrmuizel Generated by these regexes: find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/gfx[A-Za-z0-9_]*Surface\:\:[a-z]*\(\(ImageFormat\|SurfaceType\|ContentType\|MemoryLocation\)[0-9A-Za-z_]*\)/gfx\1/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/gfx[A-Za-z0-9_]*Surface\:\:[a-z]*\(\(CONTENT_\|MEMORY_\)[0-9A-Za-z_]*\)/GFX_\1/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)\(CONTENT_COLOR\|CONTENT_ALPHA\|CONTENT_COLOR_ALPHA\|CONTENT_SENTINEL\|MEMORY_IN_PROCESS_HEAP\|MEMORY_IN_PROCESS_NONHEAP\|MEMORY_OUT_OF_PROCESS\)\($\|[^A-Za-z0-9_]\)/\1GFX_\2\3/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)\(ImageFormatARGB32\|ImageFormatRGB24\|ImageFormatA8\|ImageFormatA1\|ImageFormatRGB16_565\|ImageFormatUnknown\|SurfaceTypeImage\|SurfaceTypePDF\|SurfaceTypePS\|SurfaceTypeXlib\|SurfaceTypeXcb\|SurfaceTypeGlitz\|SurfaceTypeQuartz\|SurfaceTypeWin32\|SurfaceTypeBeOS\|SurfaceTypeDirectFB\|SurfaceTypeSVG\|SurfaceTypeOS2\|SurfaceTypeWin32Printing\|SurfaceTypeQuartzImage\|SurfaceTypeScript\|SurfaceTypeQPainter\|SurfaceTypeRecording\|SurfaceTypeVG\|SurfaceTypeGL\|SurfaceTypeDRM\|SurfaceTypeTee\|SurfaceTypeXML\|SurfaceTypeSkia\|SurfaceTypeSubsurface\|SurfaceTypeD2D\|SurfaceTypeMax\)\($\|[^A-Za-z0-9_]\)/\1gfx\2\3/g'
2013-09-24 13:45:13 -07:00
gfxImageFormat Format() MOZ_OVERRIDE;
gfxReusableSurfaceWrapper* GetWritable(gfxImageSurface** aSurface) MOZ_OVERRIDE;
void ReadLock() MOZ_OVERRIDE;
void ReadUnlock() MOZ_OVERRIDE;
Type GetType()
{
return TYPE_SHARED_IMAGE;
}
/**
* Returns the shared memory segment that backs the shared image surface.
*/
mozilla::ipc::Shmem& GetShmem();
/**
* Create a gfxReusableSurfaceWrapper from the shared memory segment of a
* gfxSharedImageSurface. A ReadLock must be held, which will be adopted by
* the returned gfxReusableSurfaceWrapper.
*/
static already_AddRefed<gfxReusableSharedImageSurfaceWrapper>
Open(mozilla::layers::ISurfaceAllocator* aAllocator, const mozilla::ipc::Shmem& aShmem);
private:
mozilla::RefPtr<mozilla::layers::ISurfaceAllocator> mAllocator;
nsRefPtr<gfxSharedImageSurface> mSurface;
};
#endif // GFXSHMCOWSURFACEWRAPPER