| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef OffscreenCanvasRenderingContext2D_h | 5 #ifndef OffscreenCanvasRenderingContext2D_h |
| 6 #define OffscreenCanvasRenderingContext2D_h | 6 #define OffscreenCanvasRenderingContext2D_h |
| 7 | 7 |
| 8 #include "core/html/canvas/CanvasContextCreationAttributes.h" | 8 #include "core/html/canvas/CanvasContextCreationAttributes.h" |
| 9 #include "core/html/canvas/CanvasRenderingContext.h" | 9 #include "core/html/canvas/CanvasRenderingContext.h" |
| 10 #include "core/html/canvas/CanvasRenderingContextFactory.h" | 10 #include "core/html/canvas/CanvasRenderingContextFactory.h" |
| 11 #include "modules/canvas2d/BaseRenderingContext2D.h" | 11 #include "modules/canvas2d/BaseRenderingContext2D.h" |
| 12 #include <memory> | 12 #include <memory> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class MODULES_EXPORT OffscreenCanvasRenderingContext2D final : public CanvasRend
eringContext, public BaseRenderingContext2D { | 16 class MODULES_EXPORT OffscreenCanvasRenderingContext2D final : public CanvasRend
eringContext, public BaseRenderingContext2D { |
| 17 DEFINE_WRAPPERTYPEINFO(); | 17 DEFINE_WRAPPERTYPEINFO(); |
| 18 USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D); | 18 USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D); |
| 19 public: | 19 public: |
| 20 class Factory : public CanvasRenderingContextFactory { | 20 class Factory : public CanvasRenderingContextFactory { |
| 21 public: | 21 public: |
| 22 Factory() {} | 22 Factory() {} |
| 23 ~Factory() override {} | 23 ~Factory() override {} |
| 24 | 24 |
| 25 CanvasRenderingContext* create(ScriptState* scriptState, OffscreenCanvas
* canvas, const CanvasContextCreationAttributes& attrs) override | 25 CanvasRenderingContext* create(ScriptState* scriptState, OffscreenCanvas
* canvas, const CanvasContextCreationAttributes& attrs) override |
| 26 { | 26 { |
| 27 return new OffscreenCanvasRenderingContext2D(canvas, attrs); | 27 return new OffscreenCanvasRenderingContext2D(scriptState, canvas, at
trs); |
| 28 } | 28 } |
| 29 | 29 |
| 30 CanvasRenderingContext::ContextType getContextType() const override | 30 CanvasRenderingContext::ContextType getContextType() const override |
| 31 { | 31 { |
| 32 return CanvasRenderingContext::Context2d; | 32 return CanvasRenderingContext::Context2d; |
| 33 } | 33 } |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 // CanvasRenderingContext implementation | 36 // CanvasRenderingContext implementation |
| 37 ~OffscreenCanvasRenderingContext2D() override; | 37 ~OffscreenCanvasRenderingContext2D() override; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 68 void snapshotStateForFilter() final { } | 68 void snapshotStateForFilter() final { } |
| 69 | 69 |
| 70 void validateStateStack() final; | 70 void validateStateStack() final; |
| 71 | 71 |
| 72 bool hasAlpha() const override { return m_hasAlpha; } | 72 bool hasAlpha() const override { return m_hasAlpha; } |
| 73 bool isContextLost() const override; | 73 bool isContextLost() const override; |
| 74 | 74 |
| 75 ImageBitmap* transferToImageBitmap(ExceptionState&) final; | 75 ImageBitmap* transferToImageBitmap(ExceptionState&) final; |
| 76 | 76 |
| 77 protected: | 77 protected: |
| 78 OffscreenCanvasRenderingContext2D(OffscreenCanvas*, const CanvasContextCreat
ionAttributes& attrs); | 78 OffscreenCanvasRenderingContext2D(ScriptState*, OffscreenCanvas*, const Canv
asContextCreationAttributes& attrs); |
| 79 DECLARE_VIRTUAL_TRACE(); | 79 DECLARE_VIRTUAL_TRACE(); |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 bool m_hasAlpha; | 82 bool m_hasAlpha; |
| 83 bool m_needsMatrixClipRestore = false; | 83 bool m_needsMatrixClipRestore = false; |
| 84 std::unique_ptr<ImageBuffer> m_imageBuffer; | 84 std::unique_ptr<ImageBuffer> m_imageBuffer; |
| 85 bool m_disableReadingFromCanvas; |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 } // namespace blink | 88 } // namespace blink |
| 88 | 89 |
| 89 #endif // OffscreenCanvasRenderingContext2D_h | 90 #endif // OffscreenCanvasRenderingContext2D_h |
| OLD | NEW |