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> image; |
| 1105 if (renderingContext()->getContextType() == CanvasRenderingContext::ContextI mageBitmap) | |
|
Justin Novosad
2016/08/22 19:42:25
Avoid explicit type checks when possible. In this
zakerinasab
2016/08/22 19:55:50
Done.
| |
| 1106 image = renderingContext()->getImage()->imageForCurrentFrame(); | |
| 1107 else | |
| 1108 image = buffer()->newSkImageSnapshot(hint, reason); | |
| 1109 | |
| 1105 if (image) { | 1110 if (image) { |
| 1106 *status = NormalSourceImageStatus; | 1111 *status = NormalSourceImageStatus; |
| 1107 return StaticBitmapImage::create(image.release()); | 1112 return StaticBitmapImage::create(image.release()); |
| 1108 } | 1113 } |
| 1109 | 1114 |
| 1110 *status = InvalidSourceImageStatus; | 1115 *status = InvalidSourceImageStatus; |
| 1111 return nullptr; | 1116 return nullptr; |
| 1112 } | 1117 } |
| 1113 | 1118 |
| 1114 bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const | 1119 bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1216 | 1221 |
| 1217 bool HTMLCanvasElement::createSurfaceLayer() | 1222 bool HTMLCanvasElement::createSurfaceLayer() |
| 1218 { | 1223 { |
| 1219 DCHECK(!m_surfaceLayerBridge); | 1224 DCHECK(!m_surfaceLayerBridge); |
| 1220 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl()); | 1225 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl()); |
| 1221 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient))); | 1226 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient))); |
| 1222 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( )); | 1227 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( )); |
| 1223 } | 1228 } |
| 1224 | 1229 |
| 1225 } // namespace blink | 1230 } // namespace blink |
| OLD | NEW |