| 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& exceptionState) { | 9 DOMMatrix* DOMMatrix::create(ExceptionState& exceptionState) { |
| 10 return new DOMMatrix(TransformationMatrix()); | 10 return new DOMMatrix(TransformationMatrix()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 ExceptionState& exceptionState) { | 32 ExceptionState& exceptionState) { |
| 33 if (sequence.size() != 6 && sequence.size() != 16) { | 33 if (sequence.size() != 6 && sequence.size() != 16) { |
| 34 exceptionState.throwTypeError( | 34 exceptionState.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* float32Array, | 42 DOMMatrix* DOMMatrix::fromFloat32Array( |
| 43 ExceptionState& exceptionState) { | 43 const NotShared<DOMFloat32Array>& float32Array, |
| 44 if (float32Array->length() != 6 && float32Array->length() != 16) { | 44 ExceptionState& exceptionState) { |
| 45 if (float32Array.view()->length() != 6 && |
| 46 float32Array.view()->length() != 16) { |
| 45 exceptionState.throwTypeError( | 47 exceptionState.throwTypeError( |
| 46 "The sequence must contain 6 elements for a 2D matrix or 16 elements " | 48 "The sequence must contain 6 elements for a 2D matrix or 16 elements " |
| 47 "for a 3D matrix."); | 49 "for a 3D matrix."); |
| 48 return nullptr; | 50 return nullptr; |
| 49 } | 51 } |
| 50 return new DOMMatrix(float32Array->data(), float32Array->length()); | 52 return new DOMMatrix(float32Array.view()->data(), |
| 53 float32Array.view()->length()); |
| 51 } | 54 } |
| 52 | 55 |
| 53 DOMMatrix* DOMMatrix::fromFloat64Array(DOMFloat64Array* float64Array, | 56 DOMMatrix* DOMMatrix::fromFloat64Array( |
| 54 ExceptionState& exceptionState) { | 57 const NotShared<DOMFloat64Array>& float64Array, |
| 55 if (float64Array->length() != 6 && float64Array->length() != 16) { | 58 ExceptionState& exceptionState) { |
| 59 if (float64Array.view()->length() != 6 && |
| 60 float64Array.view()->length() != 16) { |
| 56 exceptionState.throwTypeError( | 61 exceptionState.throwTypeError( |
| 57 "The sequence must contain 6 elements for a 2D matrix or 16 elements " | 62 "The sequence must contain 6 elements for a 2D matrix or 16 elements " |
| 58 "for a 3D matrix."); | 63 "for a 3D matrix."); |
| 59 return nullptr; | 64 return nullptr; |
| 60 } | 65 } |
| 61 return new DOMMatrix(float64Array->data(), float64Array->length()); | 66 return new DOMMatrix(float64Array.view()->data(), |
| 67 float64Array.view()->length()); |
| 62 } | 68 } |
| 63 | 69 |
| 64 template <typename T> | 70 template <typename T> |
| 65 DOMMatrix::DOMMatrix(T sequence, int size) | 71 DOMMatrix::DOMMatrix(T sequence, int size) |
| 66 : DOMMatrixReadOnly(sequence, size) {} | 72 : DOMMatrixReadOnly(sequence, size) {} |
| 67 | 73 |
| 68 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2D) | 74 DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, bool is2D) |
| 69 : DOMMatrixReadOnly(matrix, is2D) {} | 75 : DOMMatrixReadOnly(matrix, is2D) {} |
| 70 | 76 |
| 71 DOMMatrix* DOMMatrix::fromMatrix(DOMMatrixInit& other, | 77 DOMMatrix* DOMMatrix::fromMatrix(DOMMatrixInit& other, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 return this; | 264 return this; |
| 259 } | 265 } |
| 260 | 266 |
| 261 DOMMatrix* DOMMatrix::setMatrixValue(const String& inputString, | 267 DOMMatrix* DOMMatrix::setMatrixValue(const String& inputString, |
| 262 ExceptionState& exceptionState) { | 268 ExceptionState& exceptionState) { |
| 263 setMatrixValueFromString(inputString, exceptionState); | 269 setMatrixValueFromString(inputString, exceptionState); |
| 264 return this; | 270 return this; |
| 265 } | 271 } |
| 266 | 272 |
| 267 } // namespace blink | 273 } // namespace blink |
| OLD | NEW |