| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return false; | 125 return false; |
| 126 if (size.width() > MaxSkiaDim || size.height() > MaxSkiaDim) | 126 if (size.width() > MaxSkiaDim || size.height() > MaxSkiaDim) |
| 127 return false; | 127 return false; |
| 128 return true; | 128 return true; |
| 129 } | 129 } |
| 130 | 130 |
| 131 PassRefPtr<Image> createTransparentImage(const IntSize& size) | 131 PassRefPtr<Image> createTransparentImage(const IntSize& size) |
| 132 { | 132 { |
| 133 DCHECK(canCreateImageBuffer(size)); | 133 DCHECK(canCreateImageBuffer(size)); |
| 134 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(size.width(), size
.height()); | 134 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(size.width(), size
.height()); |
| 135 surface->getCanvas()->clear(SK_ColorTRANSPARENT); | |
| 136 return StaticBitmapImage::create(fromSkSp(surface->makeImageSnapshot())); | 135 return StaticBitmapImage::create(fromSkSp(surface->makeImageSnapshot())); |
| 137 } | 136 } |
| 138 | 137 |
| 139 } // namespace | 138 } // namespace |
| 140 | 139 |
| 141 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) | 140 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) |
| 142 : HTMLElement(canvasTag, document) | 141 : HTMLElement(canvasTag, document) |
| 143 , ContextLifecycleObserver(&document) | 142 , ContextLifecycleObserver(&document) |
| 144 , PageLifecycleObserver(document.page()) | 143 , PageLifecycleObserver(document.page()) |
| 145 , m_size(DefaultWidth, DefaultHeight) | 144 , m_size(DefaultWidth, DefaultHeight) |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 | 1186 |
| 1188 bool HTMLCanvasElement::createSurfaceLayer() | 1187 bool HTMLCanvasElement::createSurfaceLayer() |
| 1189 { | 1188 { |
| 1190 DCHECK(!m_surfaceLayerBridge); | 1189 DCHECK(!m_surfaceLayerBridge); |
| 1191 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne
w CanvasSurfaceLayerBridgeClientImpl()); | 1190 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne
w CanvasSurfaceLayerBridgeClientImpl()); |
| 1192 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri
dgeClient))); | 1191 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri
dgeClient))); |
| 1193 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height(
)); | 1192 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height(
)); |
| 1194 } | 1193 } |
| 1195 | 1194 |
| 1196 } // namespace blink | 1195 } // namespace blink |
| OLD | NEW |