| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 87 RefPtr<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferNoAccelera
tion, SnapshotReasonUnknown); | 87 RefPtr<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferNoAccelera
tion, SnapshotReasonUnknown); |
| 88 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(skImage.release(
)); | 88 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(skImage.release(
)); |
| 89 image->setOriginClean(this->originClean()); | 89 image->setOriginClean(this->originClean()); |
| 90 m_imageBuffer.clear(); // "Transfer" means no retained buffer | 90 m_imageBuffer.reset(); // "Transfer" means no retained buffer |
| 91 return ImageBitmap::create(image.release()); | 91 return ImageBitmap::create(image.release()); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void OffscreenCanvasRenderingContext2D::setOffscreenCanvasGetContextResult(Offsc
reenRenderingContext& result) | 94 void OffscreenCanvasRenderingContext2D::setOffscreenCanvasGetContextResult(Offsc
reenRenderingContext& result) |
| 95 { | 95 { |
| 96 result.setOffscreenCanvasRenderingContext2D(this); | 96 result.setOffscreenCanvasRenderingContext2D(this); |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool OffscreenCanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, c
onst String& colorString) const | 99 bool OffscreenCanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, c
onst String& colorString) const |
| 100 { | 100 { |
| (...skipping 51 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 |