| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/geometry/DOMMatrix.h" | 5 #include "core/geometry/DOMMatrix.h" |
| 6 | 6 |
| 7 namespace blink { | 7 namespace blink { |
| 8 | 8 |
| 9 DOMMatrix* DOMMatrix::Create(ExceptionState& exception_state) { | 9 DOMMatrix* DOMMatrix::Create(ExceptionState& exception_state) { |
| 10 return new DOMMatrix(TransformationMatrix()); | 10 return new DOMMatrix(TransformationMatrix()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 ExceptionState& exception_state) { | 32 ExceptionState& exception_state) { |
| 33 if (sequence.size() != 6 && sequence.size() != 16) { | 33 if (sequence.size() != 6 && sequence.size() != 16) { |
| 34 exception_state.ThrowTypeError( | 34 exception_state.ThrowTypeError( |
| 35 "The sequence must contain 6 elements for a 2D matrix or 16 elements " | 35 "The sequence must contain 6 elements for a 2D matrix or 16 elements " |
| 36 "for a 3D matrix."); | 36 "for a 3D matrix."); |
| 37 return nullptr; | 37 return nullptr; |
| 38 } | 38 } |
| 39 return new DOMMatrix(sequence, sequence.size()); | 39 return new DOMMatrix(sequence, sequence.size()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 DOMMatrix* DOMMatrix::fromFloat32Array(DOMFloat32Array* float32_array, | 42 DOMMatrix* DOMMatrix::fromFloat32Array(NotShared<DOMFloat32Array> float32_array, |
| 43 ExceptionState& exception_state) { | 43 ExceptionState& exception_state) { |
| 44 if (float32_array->length() != 6 && float32_array->length() != 16) { | 44 if (float32_array.View()->length() != 6 && |
| 45 float32_array.View()->length() != 16) { |
| 45 exception_state.ThrowTypeError( | 46 exception_state.ThrowTypeError( |
| 46 "The sequence must contain 6 elements for a 2D matrix or 16 elements " | 47 "The sequence must contain 6 elements for a 2D matrix or 16 elements " |
| 47 "for a 3D matrix."); | 48 "for a 3D matrix."); |
| 48 return nullptr; | 49 return nullptr; |
| 49 } | 50 } |
| 50 return new DOMMatrix(float32_array->Data(), float32_array->length()); | 51 return new DOMMatrix(float32_array.View()->Data(), |
| 52 float32_array.View()->length()); |
| 51 } | 53 } |
| 52 | 54 |
| 53 DOMMatrix* DOMMatrix::fromFloat64Array(DOMFloat64Array* float64_array, | 55 DOMMatrix* DOMMatrix::fromFloat64Array(NotShared<DOMFloat64Array> float64_array, |
| 54 ExceptionState& exception_state) { | 56 ExceptionState& exception_state) { |
| 55 if (float64_array->length() != 6 && float64_array->length() != 16) { | 57 if (float64_array.View()->length() != 6 && |
| 58 float64_array.View()->length() != 16) { |
| 56 exception_state.ThrowTypeError( | 59 exception_state.ThrowTypeError( |
| 57 "The sequence must contain 6 elements for a 2D matrix or 16 elements " | 60 "The sequence must contain 6 elements for a 2D matrix or 16 elements " |
| 58 "for a 3D matrix."); | 61 "for a 3D matrix."); |
| 59 return nullptr; | 62 return nullptr; |
| 60 } | 63 } |
| 61 return new DOMMatrix(float64_array->Data(), float64_array->length()); | 64 return new DOMMatrix(float64_array.View()->Data(), |
| 65 float64_array.View()->length()); |
| 62 } | 66 } |
| 63 | 67 |
| 64 template <typename T> | 68 template <typename T> |
| 65 DOMMatrix::DOMMatrix(T sequence, int size) | 69 DOMMatrix::DOMMatrix(T sequence, int size) |
| 66 : DOMMatrixReadOnly(sequence, size) {} | 70 : DOMMatrixReadOnly(sequence, size) {} |
| 67 | 71 |
| 68 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2d) | 72 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2d) |
| 69 : DOMMatrixReadOnly(matrix, is2d) {} | 73 : DOMMatrixReadOnly(matrix, is2d) {} |
| 70 | 74 |
| 71 DOMMatrix* DOMMatrix::fromMatrix(DOMMatrixInit& other, | 75 DOMMatrix* DOMMatrix::fromMatrix(DOMMatrixInit& other, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 return this; | 262 return this; |
| 259 } | 263 } |
| 260 | 264 |
| 261 DOMMatrix* DOMMatrix::setMatrixValue(const String& input_string, | 265 DOMMatrix* DOMMatrix::setMatrixValue(const String& input_string, |
| 262 ExceptionState& exception_state) { | 266 ExceptionState& exception_state) { |
| 263 SetMatrixValueFromString(input_string, exception_state); | 267 SetMatrixValueFromString(input_string, exception_state); |
| 264 return this; | 268 return this; |
| 265 } | 269 } |
| 266 | 270 |
| 267 } // namespace blink | 271 } // namespace blink |
| OLD | NEW |