| 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(NotShared<DOMFloat32Array> float32Array, |
| 43 ExceptionState& exceptionState) { | 43 ExceptionState& exceptionState) { |
| 44 if (float32Array->length() != 6 && float32Array->length() != 16) { | 44 if (float32Array.view()->length() != 6 && |
| 45 float32Array.view()->length() != 16) { |
| 45 exceptionState.throwTypeError( | 46 exceptionState.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(float32Array->data(), float32Array->length()); | 51 return new DOMMatrix(float32Array.view()->data(), |
| 52 float32Array.view()->length()); |
| 51 } | 53 } |
| 52 | 54 |
| 53 DOMMatrix* DOMMatrix::fromFloat64Array(DOMFloat64Array* float64Array, | 55 DOMMatrix* DOMMatrix::fromFloat64Array(NotShared<DOMFloat64Array> float64Array, |
| 54 ExceptionState& exceptionState) { | 56 ExceptionState& exceptionState) { |
| 55 if (float64Array->length() != 6 && float64Array->length() != 16) { | 57 if (float64Array.view()->length() != 6 && |
| 58 float64Array.view()->length() != 16) { |
| 56 exceptionState.throwTypeError( | 59 exceptionState.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(float64Array->data(), float64Array->length()); | 64 return new DOMMatrix(float64Array.view()->data(), |
| 65 float64Array.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& inputString, | 265 DOMMatrix* DOMMatrix::setMatrixValue(const String& inputString, |
| 262 ExceptionState& exceptionState) { | 266 ExceptionState& exceptionState) { |
| 263 setMatrixValueFromString(inputString, exceptionState); | 267 setMatrixValueFromString(inputString, exceptionState); |
| 264 return this; | 268 return this; |
| 265 } | 269 } |
| 266 | 270 |
| 267 } // namespace blink | 271 } // namespace blink |
| OLD | NEW |