Index: third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.h |
diff --git a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.h b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..95e69f758a996b36b2d92867bb074c486bec2541 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.h |
@@ -0,0 +1,59 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef ImageBitmapRenderingContext_h |
+#define ImageBitmapRenderingContext_h |
+ |
+#include "core/html/canvas/CanvasRenderingContext.h" |
+#include "core/html/canvas/CanvasRenderingContextFactory.h" |
+#include "modules/ModulesExport.h" |
+#include "wtf/RefPtr.h" |
+ |
+namespace blink { |
+ |
+class ImageBitmap; |
+ |
+class MODULES_EXPORT ImageBitmapRenderingContext final : public CanvasRenderingContext { |
+ DEFINE_WRAPPERTYPEINFO(); |
+public: |
+ class Factory : public CanvasRenderingContextFactory { |
+ WTF_MAKE_NONCOPYABLE(Factory); |
+ public: |
+ Factory() {} |
+ ~Factory() override {} |
+ |
+ PassOwnPtrWillBeRawPtr<CanvasRenderingContext> create(HTMLCanvasElement*, const CanvasContextCreationAttributes&, Document&) override; |
+ CanvasRenderingContext::ContextType contextType() const override { return CanvasRenderingContext::ContextImageBitmap; } |
+ void onError(HTMLCanvasElement*, const String& error) override { } |
+ }; |
+ |
+ // Script API |
+ void transferImageBitmap(ImageBitmap*); |
+ |
+ // CanvasRenderingContext implementation |
+ ContextType contextType() const override { return CanvasRenderingContext::ContextImageBitmap; } |
+ bool hasAlpha() const override { return m_hasAlpha; } |
+ void setIsHidden(bool) override { } |
+ bool isContextLost() const override { return false; } |
+ bool paint(GraphicsContext&, const IntRect&) override; |
+ |
+ // TODO(junov): Implement GPU accelerated rendering using a layer bridge |
+ WebLayer* platformLayer() const override { return nullptr; } |
+ // TODO(junov): handle lost contexts when content is GPU-backed |
+ void loseContext(LostContextMode) override { } |
+ |
+ void stop() override; |
+ |
+ virtual ~ImageBitmapRenderingContext(); |
+ |
+private: |
+ ImageBitmapRenderingContext(HTMLCanvasElement*, CanvasContextCreationAttributes, Document&); |
+ |
+ bool m_hasAlpha; |
+ RefPtr<Image> m_image; |
+}; |
+ |
+} // blink |
+ |
+#endif |