WebCoordinatedSurface.h [plain text]
#ifndef WebCoordinatedSurface_h
#define WebCoordinatedSurface_h
#if USE(COORDINATED_GRAPHICS)
#include "ShareableBitmap.h"
#include <WebCore/CoordinatedSurface.h>
#if USE(GRAPHICS_SURFACE)
#include "GraphicsSurface.h"
#endif
namespace WebCore {
class BitmapTexture;
class GraphicsContext;
}
namespace WebKit {
class WebCoordinatedSurface : public WebCore::CoordinatedSurface {
public:
class Handle {
WTF_MAKE_NONCOPYABLE(Handle);
public:
Handle();
void encode(CoreIPC::ArgumentEncoder&) const;
static bool decode(CoreIPC::ArgumentDecoder&, Handle&);
#if USE(GRAPHICS_SURFACE)
WebCore::GraphicsSurfaceToken graphicsSurfaceToken() const { return m_graphicsSurfaceToken; }
#endif
private:
friend class WebCoordinatedSurface;
mutable ShareableBitmap::Handle m_bitmapHandle;
#if USE(GRAPHICS_SURFACE)
WebCore::GraphicsSurfaceToken m_graphicsSurfaceToken;
#endif
WebCore::IntSize m_size;
WebCore::CoordinatedSurface::Flags m_flags;
};
static PassRefPtr<WebCoordinatedSurface> create(const WebCore::IntSize&, Flags);
static PassRefPtr<WebCoordinatedSurface> create(const Handle&);
bool createHandle(Handle&);
virtual ~WebCoordinatedSurface();
virtual WebCore::IntSize size() const OVERRIDE { return m_size; }
virtual void paintToSurface(const WebCore::IntRect&, WebCore::CoordinatedSurface::Client*) OVERRIDE;
#if USE(TEXTURE_MAPPER)
virtual void copyToTexture(PassRefPtr<WebCore::BitmapTexture>, const WebCore::IntRect& target, const WebCore::IntPoint& sourceOffset) OVERRIDE;
#endif
private:
WebCoordinatedSurface(const WebCore::IntSize&, Flags, PassRefPtr<ShareableBitmap>);
virtual Flags flags() const OVERRIDE { return m_flags; }
static PassRefPtr<WebCoordinatedSurface> create(const WebCore::IntSize&, Flags, PassRefPtr<ShareableBitmap>);
PassOwnPtr<WebCore::GraphicsContext> createGraphicsContext(const WebCore::IntRect&);
#if USE(GRAPHICS_SURFACE)
WebCoordinatedSurface(const WebCore::IntSize&, Flags, PassRefPtr<WebCore::GraphicsSurface>);
static PassRefPtr<WebCoordinatedSurface> createWithSurface(const WebCore::IntSize&, Flags);
static PassRefPtr<WebCoordinatedSurface> create(const WebCore::IntSize&, Flags, PassRefPtr<WebCore::GraphicsSurface>);
bool isBackedByGraphicsSurface() const { return !!m_graphicsSurface; }
#endif
WebCore::IntSize m_size;
Flags m_flags;
RefPtr<ShareableBitmap> m_bitmap;
#if USE(GRAPHICS_SURFACE)
RefPtr<WebCore::GraphicsSurface> m_graphicsSurface;
#endif
};
}
#endif // USE(COORDINATED_GRAPHICS)
#endif // WebCoordinatedSurface_h