Chromium Code Reviews| Index: third_party/WebKit/Source/modules/canvas2d/OffscreenCanvasRenderingContext2D.h |
| diff --git a/third_party/WebKit/Source/modules/canvas2d/OffscreenCanvasRenderingContext2D.h b/third_party/WebKit/Source/modules/canvas2d/OffscreenCanvasRenderingContext2D.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6cd339399760f8e2052302852564dd1085e0d808 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/canvas2d/OffscreenCanvasRenderingContext2D.h |
| @@ -0,0 +1,75 @@ |
| +// 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. |
| + |
| +#include "core/html/canvas/CanvasContextCreationAttributes.h" |
| +#include "core/html/canvas/OffscreenCanvasRenderingContext.h" |
| +#include "core/html/canvas/OffscreenCanvasRenderingContextFactory.h" |
| +#include "modules/canvas2d/BaseRenderingContext2D.h" |
| + |
| +namespace blink { |
| + |
| +class OffscreenCanvasRenderingContext2D final : public OffscreenCanvasRenderingContext, public BaseRenderingContext2D { |
|
Justin Novosad
2016/03/02 15:41:50
This should go into yet another module 'offscreenc
|
| + DEFINE_WRAPPERTYPEINFO(); |
| + WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D); |
| +public: |
| + class Factory : public OffscreenCanvasRenderingContextFactory { |
| + WTF_MAKE_NONCOPYABLE(Factory); |
| + |
| + public: |
| + Factory() {} |
| + ~Factory() override {} |
| + |
| + PassOwnPtrWillBeRawPtr<OffscreenCanvasRenderingContext> create(OffscreenCanvas* canvas, const CanvasContextCreationAttributes& attrs) override |
| + { |
| + return adoptPtrWillBeNoop(new OffscreenCanvasRenderingContext2D(canvas, attrs)); |
| + } |
| + |
| + OffscreenCanvasRenderingContext::ContextType contextType() const override |
| + { |
| + return OffscreenCanvasRenderingContext::Context2d; |
| + } |
| + |
| + void onError(OffscreenCanvas* canvas, const String& error) override {} |
| + }; |
| + |
| + ~OffscreenCanvasRenderingContext2D() override; |
| + |
| + // BaseRenderingContext2D implementation |
| + bool originClean() const final; |
|
Justin Novosad
2016/03/02 15:41:50
For a future CL, stuff that is shared between OCRC
|
| + 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 |
| + |