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 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 | 1597 |
1597 WTF::ArrayBufferContents contents; | 1598 WTF::ArrayBufferContents contents; |
1598 if (!buffer->getImageData(Unmultiplied, imageDataRect, contents)) { | 1599 if (!buffer->getImageData(Unmultiplied, imageDataRect, contents)) { |
1599 exceptionState.throwRangeError("Out of memory at ImageData creation"); | 1600 exceptionState.throwRangeError("Out of memory at ImageData creation"); |
1600 return nullptr; | 1601 return nullptr; |
1601 } | 1602 } |
1602 | 1603 |
1603 DOMArrayBuffer* arrayBuffer = DOMArrayBuffer::create(contents); | 1604 DOMArrayBuffer* arrayBuffer = DOMArrayBuffer::create(contents); |
1604 return ImageData::create( | 1605 return ImageData::create( |
1605 imageDataRect.size(), | 1606 imageDataRect.size(), |
1606 DOMUint8ClampedArray::create(arrayBuffer, 0, arrayBuffer->byteLength())); | 1607 NotShared<DOMUint8ClampedArray>(DOMUint8ClampedArray::create( |
| 1608 arrayBuffer, 0, arrayBuffer->byteLength()))); |
1607 } | 1609 } |
1608 | 1610 |
1609 void BaseRenderingContext2D::putImageData(ImageData* data, | 1611 void BaseRenderingContext2D::putImageData(ImageData* data, |
1610 int dx, | 1612 int dx, |
1611 int dy, | 1613 int dy, |
1612 ExceptionState& exceptionState) { | 1614 ExceptionState& exceptionState) { |
1613 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), | 1615 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), |
1614 exceptionState); | 1616 exceptionState); |
1615 } | 1617 } |
1616 | 1618 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] * | 2031 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] * |
2030 m_usageCounters.numBlurredShadows + | 2032 m_usageCounters.numBlurredShadows + |
2031 ExpensiveCanvasHeuristicParameters:: | 2033 ExpensiveCanvasHeuristicParameters:: |
2032 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] * | 2034 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] * |
2033 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared; | 2035 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared; |
2034 | 2036 |
2035 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment; | 2037 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment; |
2036 } | 2038 } |
2037 | 2039 |
2038 } // namespace blink | 2040 } // namespace blink |
OLD | NEW |