| 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/UnionTypesModules.h" | 7 #include "bindings/modules/v8/UnionTypesModules.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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 { | 78 { |
| 79 if (!imageBuffer()) | 79 if (!imageBuffer()) |
| 80 return nullptr; | 80 return nullptr; |
| 81 // TODO: crbug.com/593514 Add support for GPU rendering | 81 // TODO: crbug.com/593514 Add support for GPU rendering |
| 82 RefPtr<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferNoAccelera
tion, SnapshotReasonUnknown); | 82 RefPtr<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferNoAccelera
tion, SnapshotReasonUnknown); |
| 83 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(skImage.release(
)); | 83 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(skImage.release(
)); |
| 84 m_imageBuffer.clear(); // "Transfer" means no retained buffer | 84 m_imageBuffer.clear(); // "Transfer" means no retained buffer |
| 85 return ImageBitmap::create(image.release()); | 85 return ImageBitmap::create(image.release()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void OffscreenCanvasRenderingContext2D::setOffscreenCanvasGetContextResult(Offsc
reenRenderingContext& result) |
| 89 { |
| 90 result.setOffscreenCanvasRenderingContext2D(this); |
| 91 } |
| 92 |
| 88 bool OffscreenCanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, c
onst String& colorString) const | 93 bool OffscreenCanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, c
onst String& colorString) const |
| 89 { | 94 { |
| 90 return ::blink::parseColorOrCurrentColor(color, colorString, nullptr); | 95 return ::blink::parseColorOrCurrentColor(color, colorString, nullptr); |
| 91 } | 96 } |
| 92 | 97 |
| 93 SkCanvas* OffscreenCanvasRenderingContext2D::drawingCanvas() const | 98 SkCanvas* OffscreenCanvasRenderingContext2D::drawingCanvas() const |
| 94 { | 99 { |
| 95 ImageBuffer* buffer = imageBuffer(); | 100 ImageBuffer* buffer = imageBuffer(); |
| 96 if (!buffer) | 101 if (!buffer) |
| 97 return nullptr; | 102 return nullptr; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 146 } |
| 142 #endif | 147 #endif |
| 143 } | 148 } |
| 144 | 149 |
| 145 bool OffscreenCanvasRenderingContext2D::isContextLost() const | 150 bool OffscreenCanvasRenderingContext2D::isContextLost() const |
| 146 { | 151 { |
| 147 return false; | 152 return false; |
| 148 } | 153 } |
| 149 | 154 |
| 150 } | 155 } |
| OLD | NEW |