Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.h

Issue 1598923002: Add ImageBitmapRenderingContext (experimental) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another missing adoptRef Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698