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 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 return result; | 1604 return result; |
1604 } | 1605 } |
1605 | 1606 |
1606 WTF::ArrayBufferContents contents; | 1607 WTF::ArrayBufferContents contents; |
1607 if (!buffer->GetImageData(kUnmultiplied, image_data_rect, contents)) { | 1608 if (!buffer->GetImageData(kUnmultiplied, image_data_rect, contents)) { |
1608 exception_state.ThrowRangeError("Out of memory at ImageData creation"); | 1609 exception_state.ThrowRangeError("Out of memory at ImageData creation"); |
1609 return nullptr; | 1610 return nullptr; |
1610 } | 1611 } |
1611 | 1612 |
1612 DOMArrayBuffer* array_buffer = DOMArrayBuffer::Create(contents); | 1613 DOMArrayBuffer* array_buffer = DOMArrayBuffer::Create(contents); |
1613 return ImageData::Create(image_data_rect.size(), | 1614 return ImageData::Create( |
1614 DOMUint8ClampedArray::Create( | 1615 image_data_rect.size(), |
1615 array_buffer, 0, array_buffer->ByteLength())); | 1616 NotShared<DOMUint8ClampedArray>(DOMUint8ClampedArray::Create( |
| 1617 array_buffer, 0, array_buffer->ByteLength()))); |
1616 } | 1618 } |
1617 | 1619 |
1618 void BaseRenderingContext2D::putImageData(ImageData* data, | 1620 void BaseRenderingContext2D::putImageData(ImageData* data, |
1619 int dx, | 1621 int dx, |
1620 int dy, | 1622 int dy, |
1621 ExceptionState& exception_state) { | 1623 ExceptionState& exception_state) { |
1622 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), | 1624 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), |
1623 exception_state); | 1625 exception_state); |
1624 } | 1626 } |
1625 | 1627 |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2048 ExpensiveCanvasHeuristicParameters::kShadowFixedCost[index] * | 2050 ExpensiveCanvasHeuristicParameters::kShadowFixedCost[index] * |
2049 usage_counters_.num_blurred_shadows + | 2051 usage_counters_.num_blurred_shadows + |
2050 ExpensiveCanvasHeuristicParameters:: | 2052 ExpensiveCanvasHeuristicParameters:: |
2051 kShadowVariableCostPerAreaTimesShadowBlurSquared[index] * | 2053 kShadowVariableCostPerAreaTimesShadowBlurSquared[index] * |
2052 usage_counters_.bounding_box_area_times_shadow_blur_squared; | 2054 usage_counters_.bounding_box_area_times_shadow_blur_squared; |
2053 | 2055 |
2054 return basic_cost_of_draw_calls + fill_type_adjustment + shadow_adjustment; | 2056 return basic_cost_of_draw_calls + fill_type_adjustment + shadow_adjustment; |
2055 } | 2057 } |
2056 | 2058 |
2057 } // namespace blink | 2059 } // namespace blink |
OLD | NEW |