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 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" | 5 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" |
6 | 6 |
7 #include "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingC
ontextOrWebGL2RenderingContext.h" | 7 #include "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingC
ontextOrWebGL2RenderingContext.h" |
8 #include "core/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.h" |
9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
10 #include "core/workers/WorkerGlobalScope.h" | 10 #include "core/workers/WorkerGlobalScope.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 bool OffscreenCanvasRenderingContext2D::hasImageBuffer() const { | 99 bool OffscreenCanvasRenderingContext2D::hasImageBuffer() const { |
100 return !!m_imageBuffer; | 100 return !!m_imageBuffer; |
101 } | 101 } |
102 | 102 |
103 void OffscreenCanvasRenderingContext2D::reset() { | 103 void OffscreenCanvasRenderingContext2D::reset() { |
104 m_imageBuffer = nullptr; | 104 m_imageBuffer = nullptr; |
105 BaseRenderingContext2D::reset(); | 105 BaseRenderingContext2D::reset(); |
106 } | 106 } |
107 | 107 |
| 108 void OffscreenCanvasRenderingContext2D::finalizeFrame() { |
| 109 DCHECK(offscreenCanvas()); |
| 110 offscreenCanvas()->doCommitAtEndOfTask(); |
| 111 } |
| 112 |
108 ColorBehavior OffscreenCanvasRenderingContext2D::drawImageColorBehavior() | 113 ColorBehavior OffscreenCanvasRenderingContext2D::drawImageColorBehavior() |
109 const { | 114 const { |
110 return CanvasRenderingContext::colorBehaviorForMediaDrawnToCanvas(); | 115 return CanvasRenderingContext::colorBehaviorForMediaDrawnToCanvas(); |
111 } | 116 } |
112 | 117 |
113 ImageBuffer* OffscreenCanvasRenderingContext2D::imageBuffer() const { | 118 ImageBuffer* OffscreenCanvasRenderingContext2D::imageBuffer() const { |
114 if (!m_imageBuffer) { | 119 if (!m_imageBuffer) { |
115 IntSize surfaceSize(width(), height()); | 120 IntSize surfaceSize(width(), height()); |
116 OpacityMode opacityMode = hasAlpha() ? NonOpaque : Opaque; | 121 OpacityMode opacityMode = hasAlpha() ? NonOpaque : Opaque; |
117 std::unique_ptr<ImageBufferSurface> surface; | 122 std::unique_ptr<ImageBufferSurface> surface; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 250 } |
246 | 251 |
247 bool OffscreenCanvasRenderingContext2D::isContextLost() const { | 252 bool OffscreenCanvasRenderingContext2D::isContextLost() const { |
248 return false; | 253 return false; |
249 } | 254 } |
250 | 255 |
251 bool OffscreenCanvasRenderingContext2D::isPaintable() const { | 256 bool OffscreenCanvasRenderingContext2D::isPaintable() const { |
252 return this->imageBuffer(); | 257 return this->imageBuffer(); |
253 } | 258 } |
254 } | 259 } |
OLD | NEW |