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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void SetOffscreenCanvasGetContextResult(OffscreenRenderingContext&) final; | 52 void SetOffscreenCanvasGetContextResult(OffscreenRenderingContext&) final; |
53 void SetIsHidden(bool) final { NOTREACHED(); } | 53 void SetIsHidden(bool) final { NOTREACHED(); } |
54 void Stop() final { NOTREACHED(); } | 54 void Stop() final { NOTREACHED(); } |
55 void SetCanvasGetContextResult(RenderingContext&) final {} | 55 void SetCanvasGetContextResult(RenderingContext&) final {} |
56 void clearRect(double x, double y, double width, double height) override { | 56 void clearRect(double x, double y, double width, double height) override { |
57 BaseRenderingContext2D::clearRect(x, y, width, height); | 57 BaseRenderingContext2D::clearRect(x, y, width, height); |
58 } | 58 } |
59 PassRefPtr<Image> GetImage(AccelerationHint, SnapshotReason) const final; | 59 PassRefPtr<Image> GetImage(AccelerationHint, SnapshotReason) const final; |
60 ImageData* ToImageData(SnapshotReason) override; | 60 ImageData* ToImageData(SnapshotReason) override; |
61 void Reset() override; | 61 void Reset() override; |
| 62 void RestoreCanvasMatrixClipStack(PaintCanvas* c) const override { |
| 63 RestoreMatrixClipStack(c); |
| 64 } |
62 | 65 |
63 // BaseRenderingContext2D implementation | 66 // BaseRenderingContext2D implementation |
64 bool OriginClean() const final; | 67 bool OriginClean() const final; |
65 void SetOriginTainted() final; | 68 void SetOriginTainted() final; |
66 bool WouldTaintOrigin(CanvasImageSource*, ExecutionContext*) final; | 69 bool WouldTaintOrigin(CanvasImageSource*, ExecutionContext*) final; |
67 | 70 |
68 int Width() const final; | 71 int Width() const final; |
69 int Height() const final; | 72 int Height() const final; |
70 | 73 |
71 bool HasImageBuffer() const final; | 74 bool HasImageBuffer() const final; |
(...skipping 28 matching lines...) Expand all Loading... |
100 ScriptState*, | 103 ScriptState*, |
101 OffscreenCanvas*, | 104 OffscreenCanvas*, |
102 const CanvasContextCreationAttributes& attrs); | 105 const CanvasContextCreationAttributes& attrs); |
103 DECLARE_VIRTUAL_TRACE(); | 106 DECLARE_VIRTUAL_TRACE(); |
104 | 107 |
105 virtual void NeedsFinalizeFrame() { | 108 virtual void NeedsFinalizeFrame() { |
106 CanvasRenderingContext::NeedsFinalizeFrame(); | 109 CanvasRenderingContext::NeedsFinalizeFrame(); |
107 } | 110 } |
108 | 111 |
109 private: | 112 private: |
110 bool needs_matrix_clip_restore_ = false; | |
111 std::unique_ptr<ImageBuffer> image_buffer_; | |
112 | |
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. | 122 // TODO(fserb): remove this. |
123 DEFINE_TYPE_CASTS(OffscreenCanvasRenderingContext2D, | 123 DEFINE_TYPE_CASTS(OffscreenCanvasRenderingContext2D, |
124 CanvasRenderingContext, | 124 CanvasRenderingContext, |
125 context, | 125 context, |
126 context->Is2d() && context->host(), | 126 context->Is2d() && context->host(), |
127 context.Is2d() && context.host()); | 127 context.Is2d() && context.host()); |
128 | 128 |
129 } // namespace blink | 129 } // namespace blink |
130 | 130 |
131 #endif // OffscreenCanvasRenderingContext2D_h | 131 #endif // OffscreenCanvasRenderingContext2D_h |
OLD | NEW |