| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 // A default value of quality argument for toDataURL and toBlob | 109 // A default value of quality argument for toDataURL and toBlob |
| 110 // It is in an invalid range (outside 0.0 - 1.0) so that it will not be | 110 // It is in an invalid range (outside 0.0 - 1.0) so that it will not be |
| 111 // misinterpreted as a user-input value | 111 // misinterpreted as a user-input value |
| 112 const int UndefinedQualityValue = -1.0; | 112 const int UndefinedQualityValue = -1.0; |
| 113 | 113 |
| 114 PassRefPtr<Image> createTransparentImage(const IntSize& size) { | 114 PassRefPtr<Image> createTransparentImage(const IntSize& size) { |
| 115 DCHECK(ImageBuffer::canCreateImageBuffer(size)); | 115 DCHECK(ImageBuffer::canCreateImageBuffer(size)); |
| 116 sk_sp<SkSurface> surface = | 116 sk_sp<SkSurface> surface = |
| 117 SkSurface::MakeRasterN32Premul(size.width(), size.height()); | 117 SkSurface::MakeRasterN32Premul(size.width(), size.height()); |
| 118 return StaticBitmapImage::create(surface->makeImageSnapshot()); | 118 return surface ? StaticBitmapImage::create(surface->makeImageSnapshot()) |
| 119 : nullptr; |
| 119 } | 120 } |
| 120 | 121 |
| 121 } // namespace | 122 } // namespace |
| 122 | 123 |
| 123 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) | 124 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) |
| 124 : HTMLElement(canvasTag, document), | 125 : HTMLElement(canvasTag, document), |
| 125 ContextLifecycleObserver(&document), | 126 ContextLifecycleObserver(&document), |
| 126 PageVisibilityObserver(document.page()), | 127 PageVisibilityObserver(document.page()), |
| 127 m_size(DefaultWidth, DefaultHeight), | 128 m_size(DefaultWidth, DefaultHeight), |
| 128 m_context(this, nullptr), | 129 m_context(this, nullptr), |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 mojom::blink::OffscreenCanvasSurfacePtr service; | 1384 mojom::blink::OffscreenCanvasSurfacePtr service; |
| 1384 Platform::current()->interfaceProvider()->getInterface( | 1385 Platform::current()->interfaceProvider()->getInterface( |
| 1385 mojo::GetProxy(&service)); | 1386 mojo::GetProxy(&service)); |
| 1386 m_surfaceLayerBridge = | 1387 m_surfaceLayerBridge = |
| 1387 wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); | 1388 wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); |
| 1388 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), | 1389 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), |
| 1389 this->height()); | 1390 this->height()); |
| 1390 } | 1391 } |
| 1391 | 1392 |
| 1392 } // namespace blink | 1393 } // namespace blink |
| OLD | NEW |