| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 if (size.width() * size.height() > MaxCanvasArea) | 119 if (size.width() * size.height() > MaxCanvasArea) |
| 120 return false; | 120 return false; |
| 121 if (size.width() > MaxSkiaDim || size.height() > MaxSkiaDim) | 121 if (size.width() > MaxSkiaDim || size.height() > MaxSkiaDim) |
| 122 return false; | 122 return false; |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 | 125 |
| 126 PassRefPtr<Image> createTransparentImage(const IntSize& size) | 126 PassRefPtr<Image> createTransparentImage(const IntSize& size) |
| 127 { | 127 { |
| 128 ASSERT(canCreateImageBuffer(size)); | 128 ASSERT(canCreateImageBuffer(size)); |
| 129 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterN32Premul(size.widt
h(), size.height())); | 129 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(size.width(), size
.height()); |
| 130 surface->getCanvas()->clear(SK_ColorTRANSPARENT); | 130 surface->getCanvas()->clear(SK_ColorTRANSPARENT); |
| 131 return StaticBitmapImage::create(adoptRef(surface->newImageSnapshot())); | 131 return StaticBitmapImage::create(adoptRef(surface->newImageSnapshot())); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace | 134 } // namespace |
| 135 | 135 |
| 136 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) | 136 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) |
| 137 : HTMLElement(canvasTag, document) | 137 : HTMLElement(canvasTag, document) |
| 138 , DocumentVisibilityObserver(document) | 138 , DocumentVisibilityObserver(document) |
| 139 , m_size(DefaultWidth, DefaultHeight) | 139 , m_size(DefaultWidth, DefaultHeight) |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 std::pair<Element*, String> HTMLCanvasElement::getControlAndIdIfHitRegionExists(
const LayoutPoint& location) | 1122 std::pair<Element*, String> HTMLCanvasElement::getControlAndIdIfHitRegionExists(
const LayoutPoint& location) |
| 1123 { | 1123 { |
| 1124 if (m_context && m_context->is2d()) | 1124 if (m_context && m_context->is2d()) |
| 1125 return m_context->getControlAndIdIfHitRegionExists(location); | 1125 return m_context->getControlAndIdIfHitRegionExists(location); |
| 1126 return std::make_pair(nullptr, String()); | 1126 return std::make_pair(nullptr, String()); |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 } // namespace blink | 1129 } // namespace blink |
| OLD | NEW |