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" |
(...skipping 19 matching lines...) Expand all Loading... | |
30 OffscreenCanvas* canvas, | 30 OffscreenCanvas* canvas, |
31 const CanvasContextCreationAttributes& attrs) override { | 31 const CanvasContextCreationAttributes& attrs) override { |
32 return new OffscreenCanvasRenderingContext2D(script_state, canvas, attrs); | 32 return new OffscreenCanvasRenderingContext2D(script_state, canvas, attrs); |
33 } | 33 } |
34 | 34 |
35 CanvasRenderingContext::ContextType GetContextType() const override { | 35 CanvasRenderingContext::ContextType GetContextType() const override { |
36 return CanvasRenderingContext::kContext2d; | 36 return CanvasRenderingContext::kContext2d; |
37 } | 37 } |
38 }; | 38 }; |
39 | 39 |
40 OffscreenCanvas* offscreenCanvas() const { | 40 OffscreenCanvas* offscreenCanvasForBinding() const { |
Justin Novosad
2017/05/04 20:55:24
Nit: Binding -> Bindings
| |
41 DCHECK(!host() || host()->IsOffscreenCanvas()); | 41 DCHECK(!host() || host()->IsOffscreenCanvas()); |
42 return static_cast<OffscreenCanvas*>(host()); | 42 return static_cast<OffscreenCanvas*>(host()); |
43 } | 43 } |
44 ScriptPromise commit(ScriptState*, ExceptionState&); | 44 ScriptPromise commit(ScriptState*, ExceptionState&); |
45 | 45 |
46 // CanvasRenderingContext implementation | 46 // CanvasRenderingContext implementation |
47 ~OffscreenCanvasRenderingContext2D() override; | 47 ~OffscreenCanvasRenderingContext2D() override; |
48 ContextType GetContextType() const override { return kContext2d; } | 48 ContextType GetContextType() const override { return kContext2d; } |
49 bool Is2d() const override { return true; } | 49 bool Is2d() const override { return true; } |
50 bool IsComposited() const override { return false; } | 50 bool IsComposited() const override { return false; } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 private: | 112 private: |
113 bool IsPaintable() const final; | 113 bool IsPaintable() const final; |
114 | 114 |
115 RefPtr<StaticBitmapImage> TransferToStaticBitmapImage(); | 115 RefPtr<StaticBitmapImage> TransferToStaticBitmapImage(); |
116 | 116 |
117 CanvasColorSpace ColorSpace() const override; | 117 CanvasColorSpace ColorSpace() const override; |
118 String ColorSpaceAsString() const override; | 118 String ColorSpaceAsString() const override; |
119 CanvasPixelFormat PixelFormat() const override; | 119 CanvasPixelFormat PixelFormat() const override; |
120 }; | 120 }; |
121 | 121 |
122 // TODO(fserb): remove this. | |
123 DEFINE_TYPE_CASTS(OffscreenCanvasRenderingContext2D, | 122 DEFINE_TYPE_CASTS(OffscreenCanvasRenderingContext2D, |
124 CanvasRenderingContext, | 123 CanvasRenderingContext, |
125 context, | 124 context, |
126 context->Is2d() && context->host(), | 125 context->Is2d() && context->host(), |
127 context.Is2d() && context.host()); | 126 context.Is2d() && context.host()); |
128 | 127 |
129 } // namespace blink | 128 } // namespace blink |
130 | 129 |
131 #endif // OffscreenCanvasRenderingContext2D_h | 130 #endif // OffscreenCanvasRenderingContext2D_h |
OLD | NEW |