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(IPC::Encoder&) const;
static bool decode(IPC::Decoder&, 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 RefPtr<WebCoordinatedSurface> create(const WebCore::IntSize&, Flags);
static RefPtr<WebCoordinatedSurface> create(const Handle&);
bool createHandle(Handle&);
virtual ~WebCoordinatedSurface();
void paintToSurface(const WebCore::IntRect&, WebCore::CoordinatedSurface::Client&) override;
#if USE(TEXTURE_MAPPER)
void copyToTexture(RefPtr<WebCore::BitmapTexture>, const WebCore::IntRect& target, const WebCore::IntPoint& sourceOffset) override;
#endif
private:
WebCoordinatedSurface(const WebCore::IntSize&, Flags, RefPtr<ShareableBitmap>);
static Ref<WebCoordinatedSurface> create(const WebCore::IntSize&, Flags, RefPtr<ShareableBitmap>);
std::unique_ptr<WebCore::GraphicsContext> createGraphicsContext(const WebCore::IntRect&);
#if USE(GRAPHICS_SURFACE)
WebCoordinatedSurface(const WebCore::IntSize&, Flags, RefPtr<WebCore::GraphicsSurface>);
static RefPtr<WebCoordinatedSurface> createWithSurface(const WebCore::IntSize&, Flags);
static Ref<WebCoordinatedSurface> create(const WebCore::IntSize&, Flags, RefPtr<WebCore::GraphicsSurface>);
bool isBackedByGraphicsSurface() const { return !!m_graphicsSurface; }
#endif
RefPtr<ShareableBitmap> m_bitmap;
#if USE(GRAPHICS_SURFACE)
RefPtr<WebCore::GraphicsSurface> m_graphicsSurface;
#endif
};
}
#endif // USE(COORDINATED_GRAPHICS)
#endif // WebCoordinatedSurface_h