| 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 "platform/graphics/ImageBuffer.h" | 9 #include "platform/graphics/ImageBuffer.h" |
| 10 #include "platform/graphics/StaticBitmapImage.h" | 10 #include "platform/graphics/StaticBitmapImage.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 { | 66 { |
| 67 return !!m_imageBuffer; | 67 return !!m_imageBuffer; |
| 68 } | 68 } |
| 69 | 69 |
| 70 ImageBuffer* OffscreenCanvasRenderingContext2D::imageBuffer() const | 70 ImageBuffer* OffscreenCanvasRenderingContext2D::imageBuffer() const |
| 71 { | 71 { |
| 72 if (!m_imageBuffer) { | 72 if (!m_imageBuffer) { |
| 73 // TODO: crbug.com/593514 Add support for GPU rendering | 73 // TODO: crbug.com/593514 Add support for GPU rendering |
| 74 OffscreenCanvasRenderingContext2D* nonConstThis = const_cast<OffscreenCa
nvasRenderingContext2D*>(this); | 74 OffscreenCanvasRenderingContext2D* nonConstThis = const_cast<OffscreenCa
nvasRenderingContext2D*>(this); |
| 75 nonConstThis->m_imageBuffer = ImageBuffer::create(IntSize(width(), heigh
t()), m_hasAlpha ? NonOpaque : Opaque, InitializeImagePixels); | 75 nonConstThis->m_imageBuffer = ImageBuffer::create(IntSize(width(), heigh
t()), m_hasAlpha ? NonOpaque : Opaque, InitializeImagePixels); |
| 76 // TODO: crbug.com/593349 Restore matrix and clip state on the new Image
Buffer. | 76 restoreMatrixClipStack(m_imageBuffer->canvas()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 return m_imageBuffer.get(); | 79 return m_imageBuffer.get(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 ImageBitmap* OffscreenCanvasRenderingContext2D::transferToImageBitmap(ExceptionS
tate& exceptionState) | 82 ImageBitmap* OffscreenCanvasRenderingContext2D::transferToImageBitmap(ExceptionS
tate& exceptionState) |
| 83 { | 83 { |
| 84 if (!imageBuffer()) | 84 if (!imageBuffer()) |
| 85 return nullptr; | 85 return nullptr; |
| 86 // TODO: crbug.com/593514 Add support for GPU rendering | 86 // TODO: crbug.com/593514 Add support for GPU rendering |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 #endif | 153 #endif |
| 154 } | 154 } |
| 155 | 155 |
| 156 bool OffscreenCanvasRenderingContext2D::isContextLost() const | 156 bool OffscreenCanvasRenderingContext2D::isContextLost() const |
| 157 { | 157 { |
| 158 return false; | 158 return false; |
| 159 } | 159 } |
| 160 | 160 |
| 161 } | 161 } |
| OLD | NEW |