ImageBufferShareableBitmapBackend.h [plain text]
#pragma once
#if ENABLE(GPU_PROCESS)
#include "ImageBufferBackendHandle.h"
#include <WebCore/PlatformImageBufferBackend.h>
#include <wtf/IsoMalloc.h>
namespace WebCore {
class ImageData;
}
namespace WebKit {
class ShareableBitmap;
class ImageBufferShareableBitmapBackend : public WebCore::PlatformImageBufferBackend {
WTF_MAKE_ISO_ALLOCATED(ImageBufferShareableBitmapBackend);
WTF_MAKE_NONCOPYABLE(ImageBufferShareableBitmapBackend);
public:
static std::unique_ptr<ImageBufferShareableBitmapBackend> create(const WebCore::FloatSize& logicalSize, const float resolutionScale, WebCore::ColorSpace, const WebCore::HostWindow*);
static std::unique_ptr<ImageBufferShareableBitmapBackend> create(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& internalSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle);
ImageBufferShareableBitmapBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& physicalSize, float resolutionScale, WebCore::ColorSpace, RefPtr<ShareableBitmap>&&, std::unique_ptr<WebCore::GraphicsContext>&&);
ImageBufferBackendHandle createImageBufferBackendHandle() const;
WebCore::GraphicsContext& context() const override { return *m_context; }
WebCore::NativeImagePtr copyNativeImage(WebCore::BackingStoreCopy = WebCore::CopyBackingStore) const override;
RefPtr<WebCore::Image> copyImage(WebCore::BackingStoreCopy = WebCore::CopyBackingStore, WebCore::PreserveResolution = WebCore::PreserveResolution::No) const override;
Vector<uint8_t> toBGRAData() const override;
RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect&) const override;
void putImageData(WebCore::AlphaPremultiplication inputFormat, const WebCore::ImageData&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) override;
private:
#if PLATFORM(IOS_FAMILY)
ColorFormat backendColorFormat() const override { return ColorFormat::BGRA; }
#endif
RefPtr<ShareableBitmap> m_bitmap;
std::unique_ptr<WebCore::GraphicsContext> m_context;
};
}
#endif // ENABLE(GPU_PROCESS)