| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // per pixel per buffer. | 105 // per pixel per buffer. |
| 106 const int MaxGlobalGPUMemoryUsage = | 106 const int MaxGlobalGPUMemoryUsage = |
| 107 4000000 * MaxGlobalAcceleratedImageBufferCount; | 107 4000000 * MaxGlobalAcceleratedImageBufferCount; |
| 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 sk_sp<SkImage> createTransparentSkImage(const IntSize& size) { | 114 sk_sp<SkImage> createTransparentSkImage(const IntSize& size) { |
| 115 DCHECK(ImageBuffer::canCreateImageBuffer(size)); | 115 if (!ImageBuffer::canCreateImageBuffer(size)) |
| 116 return nullptr; |
| 116 sk_sp<SkSurface> surface = | 117 sk_sp<SkSurface> surface = |
| 117 SkSurface::MakeRasterN32Premul(size.width(), size.height()); | 118 SkSurface::MakeRasterN32Premul(size.width(), size.height()); |
| 118 return surface ? surface->makeImageSnapshot() : nullptr; | 119 return surface ? surface->makeImageSnapshot() : nullptr; |
| 119 } | 120 } |
| 120 | 121 |
| 121 PassRefPtr<Image> createTransparentImage(const IntSize& size) { | 122 PassRefPtr<Image> createTransparentImage(const IntSize& size) { |
| 122 sk_sp<SkImage> image = createTransparentSkImage(size); | 123 sk_sp<SkImage> image = createTransparentSkImage(size); |
| 123 return image ? StaticBitmapImage::create(image) : nullptr; | 124 return image ? StaticBitmapImage::create(image) : nullptr; |
| 124 } | 125 } |
| 125 | 126 |
| (...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this)); | 1415 m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this)); |
| 1415 // Creates a placeholder layer first before Surface is created. | 1416 // Creates a placeholder layer first before Surface is created. |
| 1416 m_surfaceLayerBridge->createSolidColorLayer(); | 1417 m_surfaceLayerBridge->createSolidColorLayer(); |
| 1417 } | 1418 } |
| 1418 | 1419 |
| 1419 void HTMLCanvasElement::OnWebLayerReplaced() { | 1420 void HTMLCanvasElement::OnWebLayerReplaced() { |
| 1420 setNeedsCompositingUpdate(); | 1421 setNeedsCompositingUpdate(); |
| 1421 } | 1422 } |
| 1422 | 1423 |
| 1423 } // namespace blink | 1424 } // namespace blink |
| OLD | NEW |