| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/canvas2d/BaseRenderingContext2D.h" | 5 #include "modules/canvas2d/BaseRenderingContext2D.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionMessages.h" | 7 #include "bindings/core/v8/ExceptionMessages.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "core/css/cssom/CSSURLImageValue.h" | 10 #include "core/css/cssom/CSSURLImageValue.h" |
| 11 #include "core/css/parser/CSSParser.h" | 11 #include "core/css/parser/CSSParser.h" |
| 12 #include "core/dom/NotShared.h" |
| 12 #include "core/frame/ImageBitmap.h" | 13 #include "core/frame/ImageBitmap.h" |
| 13 #include "core/html/HTMLCanvasElement.h" | 14 #include "core/html/HTMLCanvasElement.h" |
| 14 #include "core/html/HTMLImageElement.h" | 15 #include "core/html/HTMLImageElement.h" |
| 15 #include "core/html/HTMLVideoElement.h" | 16 #include "core/html/HTMLVideoElement.h" |
| 16 #include "core/html/ImageData.h" | 17 #include "core/html/ImageData.h" |
| 17 #include "core/offscreencanvas/OffscreenCanvas.h" | 18 #include "core/offscreencanvas/OffscreenCanvas.h" |
| 18 #include "core/svg/SVGImageElement.h" | 19 #include "core/svg/SVGImageElement.h" |
| 19 #include "modules/canvas2d/CanvasGradient.h" | 20 #include "modules/canvas2d/CanvasGradient.h" |
| 20 #include "modules/canvas2d/CanvasPattern.h" | 21 #include "modules/canvas2d/CanvasPattern.h" |
| 21 #include "modules/canvas2d/CanvasStyle.h" | 22 #include "modules/canvas2d/CanvasStyle.h" |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 | 1601 |
| 1601 WTF::ArrayBufferContents contents; | 1602 WTF::ArrayBufferContents contents; |
| 1602 if (!buffer->getImageData(Unmultiplied, imageDataRect, contents)) { | 1603 if (!buffer->getImageData(Unmultiplied, imageDataRect, contents)) { |
| 1603 exceptionState.throwRangeError("Out of memory at ImageData creation"); | 1604 exceptionState.throwRangeError("Out of memory at ImageData creation"); |
| 1604 return nullptr; | 1605 return nullptr; |
| 1605 } | 1606 } |
| 1606 | 1607 |
| 1607 DOMArrayBuffer* arrayBuffer = DOMArrayBuffer::create(contents); | 1608 DOMArrayBuffer* arrayBuffer = DOMArrayBuffer::create(contents); |
| 1608 return ImageData::create( | 1609 return ImageData::create( |
| 1609 imageDataRect.size(), | 1610 imageDataRect.size(), |
| 1610 DOMUint8ClampedArray::create(arrayBuffer, 0, arrayBuffer->byteLength())); | 1611 NotShared<DOMUint8ClampedArray>(DOMUint8ClampedArray::create( |
| 1612 arrayBuffer, 0, arrayBuffer->byteLength()))); |
| 1611 } | 1613 } |
| 1612 | 1614 |
| 1613 void BaseRenderingContext2D::putImageData(ImageData* data, | 1615 void BaseRenderingContext2D::putImageData(ImageData* data, |
| 1614 double dx, | 1616 double dx, |
| 1615 double dy, | 1617 double dy, |
| 1616 ExceptionState& exceptionState) { | 1618 ExceptionState& exceptionState) { |
| 1617 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), | 1619 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), |
| 1618 exceptionState); | 1620 exceptionState); |
| 1619 } | 1621 } |
| 1620 | 1622 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2025 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] * | 2027 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] * |
| 2026 m_usageCounters.numBlurredShadows + | 2028 m_usageCounters.numBlurredShadows + |
| 2027 ExpensiveCanvasHeuristicParameters:: | 2029 ExpensiveCanvasHeuristicParameters:: |
| 2028 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] * | 2030 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] * |
| 2029 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared; | 2031 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared; |
| 2030 | 2032 |
| 2031 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment; | 2033 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment; |
| 2032 } | 2034 } |
| 2033 | 2035 |
| 2034 } // namespace blink | 2036 } // namespace blink |
| OLD | NEW |