| 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" | |
| 13 #include "core/frame/ImageBitmap.h" | 12 #include "core/frame/ImageBitmap.h" |
| 14 #include "core/html/HTMLCanvasElement.h" | 13 #include "core/html/HTMLCanvasElement.h" |
| 15 #include "core/html/HTMLImageElement.h" | 14 #include "core/html/HTMLImageElement.h" |
| 16 #include "core/html/HTMLVideoElement.h" | 15 #include "core/html/HTMLVideoElement.h" |
| 17 #include "core/html/ImageData.h" | 16 #include "core/html/ImageData.h" |
| 18 #include "core/offscreencanvas/OffscreenCanvas.h" | 17 #include "core/offscreencanvas/OffscreenCanvas.h" |
| 19 #include "core/svg/SVGImageElement.h" | 18 #include "core/svg/SVGImageElement.h" |
| 20 #include "modules/canvas2d/CanvasGradient.h" | 19 #include "modules/canvas2d/CanvasGradient.h" |
| 21 #include "modules/canvas2d/CanvasPattern.h" | 20 #include "modules/canvas2d/CanvasPattern.h" |
| 22 #include "modules/canvas2d/CanvasStyle.h" | 21 #include "modules/canvas2d/CanvasStyle.h" |
| (...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 | 1605 |
| 1607 WTF::ArrayBufferContents contents; | 1606 WTF::ArrayBufferContents contents; |
| 1608 if (!buffer->GetImageData(kUnmultiplied, image_data_rect, contents)) { | 1607 if (!buffer->GetImageData(kUnmultiplied, image_data_rect, contents)) { |
| 1609 exception_state.ThrowRangeError("Out of memory at ImageData creation"); | 1608 exception_state.ThrowRangeError("Out of memory at ImageData creation"); |
| 1610 return nullptr; | 1609 return nullptr; |
| 1611 } | 1610 } |
| 1612 | 1611 |
| 1613 NeedsFinalizeFrame(); | 1612 NeedsFinalizeFrame(); |
| 1614 | 1613 |
| 1615 DOMArrayBuffer* array_buffer = DOMArrayBuffer::Create(contents); | 1614 DOMArrayBuffer* array_buffer = DOMArrayBuffer::Create(contents); |
| 1616 return ImageData::Create( | 1615 return ImageData::Create(image_data_rect.size(), |
| 1617 image_data_rect.size(), | 1616 DOMUint8ClampedArray::Create( |
| 1618 NotShared<DOMUint8ClampedArray>(DOMUint8ClampedArray::Create( | 1617 array_buffer, 0, array_buffer->ByteLength())); |
| 1619 array_buffer, 0, array_buffer->ByteLength()))); | |
| 1620 } | 1618 } |
| 1621 | 1619 |
| 1622 void BaseRenderingContext2D::putImageData(ImageData* data, | 1620 void BaseRenderingContext2D::putImageData(ImageData* data, |
| 1623 int dx, | 1621 int dx, |
| 1624 int dy, | 1622 int dy, |
| 1625 ExceptionState& exception_state) { | 1623 ExceptionState& exception_state) { |
| 1626 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), | 1624 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), |
| 1627 exception_state); | 1625 exception_state); |
| 1628 } | 1626 } |
| 1629 | 1627 |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 ExpensiveCanvasHeuristicParameters::kShadowFixedCost[index] * | 2050 ExpensiveCanvasHeuristicParameters::kShadowFixedCost[index] * |
| 2053 usage_counters_.num_blurred_shadows + | 2051 usage_counters_.num_blurred_shadows + |
| 2054 ExpensiveCanvasHeuristicParameters:: | 2052 ExpensiveCanvasHeuristicParameters:: |
| 2055 kShadowVariableCostPerAreaTimesShadowBlurSquared[index] * | 2053 kShadowVariableCostPerAreaTimesShadowBlurSquared[index] * |
| 2056 usage_counters_.bounding_box_area_times_shadow_blur_squared; | 2054 usage_counters_.bounding_box_area_times_shadow_blur_squared; |
| 2057 | 2055 |
| 2058 return basic_cost_of_draw_calls + fill_type_adjustment + shadow_adjustment; | 2056 return basic_cost_of_draw_calls + fill_type_adjustment + shadow_adjustment; |
| 2059 } | 2057 } |
| 2060 | 2058 |
| 2061 } // namespace blink | 2059 } // namespace blink |
| OLD | NEW |