Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1094 | 1094 |
| 1095 if (!m_context) { | 1095 if (!m_context) { |
| 1096 *status = NormalSourceImageStatus; | 1096 *status = NormalSourceImageStatus; |
| 1097 return createTransparentImage(size()); | 1097 return createTransparentImage(size()); |
| 1098 } | 1098 } |
| 1099 | 1099 |
| 1100 if (m_context->is3d()) { | 1100 if (m_context->is3d()) { |
| 1101 m_context->paintRenderingResultsToCanvas(BackBuffer); | 1101 m_context->paintRenderingResultsToCanvas(BackBuffer); |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 RefPtr<SkImage> image = buffer()->newSkImageSnapshot(hint, reason); | 1104 RefPtr<SkImage> skImage; |
| 1105 if (image) { | 1105 RefPtr<blink::Image> image = renderingContext()->getImage(); |
| 1106 if (image) | |
| 1107 skImage = image->imageForCurrentFrame(); | |
| 1108 else | |
| 1109 skImage = buffer()->newSkImageSnapshot(hint, reason); | |
|
Justin Novosad
2016/08/22 20:03:02
Just realized this code may inadvertently allocate
zakerinasab
2016/08/22 20:19:09
createTransparentImage(size()) returns PassRefPtr<
| |
| 1110 | |
| 1111 if (skImage) { | |
| 1106 *status = NormalSourceImageStatus; | 1112 *status = NormalSourceImageStatus; |
| 1107 return StaticBitmapImage::create(image.release()); | 1113 return StaticBitmapImage::create(skImage.release()); |
| 1108 } | 1114 } |
| 1109 | 1115 |
| 1110 *status = InvalidSourceImageStatus; | 1116 *status = InvalidSourceImageStatus; |
| 1111 return nullptr; | 1117 return nullptr; |
| 1112 } | 1118 } |
| 1113 | 1119 |
| 1114 bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const | 1120 bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const |
| 1115 { | 1121 { |
| 1116 return !originClean(); | 1122 return !originClean(); |
| 1117 } | 1123 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1216 | 1222 |
| 1217 bool HTMLCanvasElement::createSurfaceLayer() | 1223 bool HTMLCanvasElement::createSurfaceLayer() |
| 1218 { | 1224 { |
| 1219 DCHECK(!m_surfaceLayerBridge); | 1225 DCHECK(!m_surfaceLayerBridge); |
| 1220 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl()); | 1226 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl()); |
| 1221 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient))); | 1227 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient))); |
| 1222 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( )); | 1228 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( )); |
| 1223 } | 1229 } |
| 1224 | 1230 |
| 1225 } // namespace blink | 1231 } // namespace blink |
| OLD | NEW |