Index: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h |
diff --git a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f827d8a4bef6c8779d7b75e98d9a39a63bf63046 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h |
@@ -0,0 +1,83 @@ |
+// 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 OffscreenCanvasRenderingContext2D_h |
+#define OffscreenCanvasRenderingContext2D_h |
+ |
+#include "core/html/canvas/CanvasContextCreationAttributes.h" |
+#include "modules/ModulesExport.h" |
+#include "modules/canvas2d/BaseRenderingContext2D.h" |
+#include "modules/offscreencanvas/OffscreenCanvasRenderingContext.h" |
+#include "modules/offscreencanvas/OffscreenCanvasRenderingContextFactory.h" |
+ |
+namespace blink { |
+ |
+class MODULES_EXPORT OffscreenCanvasRenderingContext2D final : public OffscreenCanvasRenderingContext, public BaseRenderingContext2D { |
+ DEFINE_WRAPPERTYPEINFO(); |
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D); |
+public: |
+ class Factory : public OffscreenCanvasRenderingContextFactory { |
+ WTF_MAKE_NONCOPYABLE(Factory); |
haraken
2016/03/04 16:22:15
This won't be needed since the parent class has th
xlai (Olivia)
2016/03/06 22:47:35
Done for here and elsewhere.
|
+ |
+ public: |
+ Factory() {} |
+ ~Factory() override {} |
+ |
+ OffscreenCanvasRenderingContext* create(OffscreenCanvas* canvas, const CanvasContextCreationAttributes& attrs) override |
+ { |
+ return new OffscreenCanvasRenderingContext2D(canvas, attrs); |
+ } |
+ |
+ OffscreenCanvasRenderingContext::ContextType contextType() const override |
+ { |
+ return OffscreenCanvasRenderingContext::Context2d; |
+ } |
+ |
+ void onError(OffscreenCanvas* canvas, const String& error) override {} |
+ }; |
+ |
+ // OffscreenCanvasRenderingContext implementation |
+ ~OffscreenCanvasRenderingContext2D() override; |
+ ContextType contextType() const override { return Context2d; } |
+ bool is2d() const override { return true; } |
+ |
+ // BaseRenderingContext2D implementation |
+ bool originClean() const final; |
+ void setOriginTainted() final; |
+ bool wouldTaintOrigin(CanvasImageSource*) final; |
+ |
+ int width() const final; |
+ int height() const final; |
+ |
+ bool hasImageBuffer() const final; |
+ ImageBuffer* imageBuffer() const final; |
+ |
+ bool parseColorOrCurrentColor(Color&, const String& colorString) const final; |
+ |
+ SkCanvas* drawingCanvas() const final; |
+ SkCanvas* existingDrawingCanvas() const final; |
+ void disableDeferral(DisableDeferralReason) final; |
+ |
+ AffineTransform baseTransform() const final; |
+ void didDraw(const SkIRect& dirtyRect) final; |
+ |
+ bool stateHasFilter() final; |
+ SkImageFilter* stateGetFilter() final; |
+ |
+ void validateStateStack() final; |
+ |
+ bool hasAlpha() const override { return m_hasAlpha; } |
+ bool isContextLost() const override; |
+ |
+protected: |
+ OffscreenCanvasRenderingContext2D(OffscreenCanvas*, const CanvasContextCreationAttributes& attrs); |
+ DECLARE_VIRTUAL_TRACE(); |
+ |
+private: |
+ bool m_hasAlpha; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // OffscreenCanvasRenderingContext2D_h |