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 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 NeedsFinalizeFrame(); | 1613 NeedsFinalizeFrame(); |
1613 | 1614 |
1614 DOMArrayBuffer* array_buffer = DOMArrayBuffer::Create(contents); | 1615 DOMArrayBuffer* array_buffer = DOMArrayBuffer::Create(contents); |
1615 return ImageData::Create(image_data_rect.size(), | 1616 return ImageData::Create( |
1616 DOMUint8ClampedArray::Create( | 1617 image_data_rect.size(), |
1617 array_buffer, 0, array_buffer->ByteLength())); | 1618 NotShared<DOMUint8ClampedArray>(DOMUint8ClampedArray::Create( |
| 1619 array_buffer, 0, array_buffer->ByteLength()))); |
1618 } | 1620 } |
1619 | 1621 |
1620 void BaseRenderingContext2D::putImageData(ImageData* data, | 1622 void BaseRenderingContext2D::putImageData(ImageData* data, |
1621 int dx, | 1623 int dx, |
1622 int dy, | 1624 int dy, |
1623 ExceptionState& exception_state) { | 1625 ExceptionState& exception_state) { |
1624 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), | 1626 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), |
1625 exception_state); | 1627 exception_state); |
1626 } | 1628 } |
1627 | 1629 |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 ExpensiveCanvasHeuristicParameters::kShadowFixedCost[index] * | 2052 ExpensiveCanvasHeuristicParameters::kShadowFixedCost[index] * |
2051 usage_counters_.num_blurred_shadows + | 2053 usage_counters_.num_blurred_shadows + |
2052 ExpensiveCanvasHeuristicParameters:: | 2054 ExpensiveCanvasHeuristicParameters:: |
2053 kShadowVariableCostPerAreaTimesShadowBlurSquared[index] * | 2055 kShadowVariableCostPerAreaTimesShadowBlurSquared[index] * |
2054 usage_counters_.bounding_box_area_times_shadow_blur_squared; | 2056 usage_counters_.bounding_box_area_times_shadow_blur_squared; |
2055 | 2057 |
2056 return basic_cost_of_draw_calls + fill_type_adjustment + shadow_adjustment; | 2058 return basic_cost_of_draw_calls + fill_type_adjustment + shadow_adjustment; |
2057 } | 2059 } |
2058 | 2060 |
2059 } // namespace blink | 2061 } // namespace blink |
OLD | NEW |