| 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/DOMPointReadOnly.h" | 5 #include "core/geometry/DOMPointReadOnly.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "bindings/core/v8/V8ObjectBuilder.h" | 9 #include "bindings/core/v8/V8ObjectBuilder.h" |
| 10 #include "core/geometry/DOMMatrixInit.h" | 10 #include "core/geometry/DOMMatrixInit.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return new DOMPointReadOnly(other.x(), other.y(), other.z(), other.w()); | 35 return new DOMPointReadOnly(other.x(), other.y(), other.z(), other.w()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 DOMPoint* DOMPointReadOnly::matrixTransform(DOMMatrixInit& other, | 38 DOMPoint* DOMPointReadOnly::matrixTransform(DOMMatrixInit& other, |
| 39 ExceptionState& exception_state) { | 39 ExceptionState& exception_state) { |
| 40 DOMMatrixReadOnly* matrix = | 40 DOMMatrixReadOnly* matrix = |
| 41 DOMMatrixReadOnly::fromMatrix(other, exception_state); | 41 DOMMatrixReadOnly::fromMatrix(other, exception_state); |
| 42 | 42 |
| 43 if (matrix->is2D() && z() == 0 && w() == 1) { | 43 if (matrix->is2D() && z() == 0 && w() == 1) { |
| 44 double transformed_x = | 44 double transformed_x = |
| 45 x() * matrix->m11() + y() * matrix->m12() + matrix->m41(); | 45 x() * matrix->m11() + y() * matrix->m21() + matrix->m41(); |
| 46 double transformed_y = | 46 double transformed_y = |
| 47 x() * matrix->m12() + y() * matrix->m22() + matrix->m42(); | 47 x() * matrix->m12() + y() * matrix->m22() + matrix->m42(); |
| 48 return DOMPoint::Create(transformed_x, transformed_y, 0, 1); | 48 return DOMPoint::Create(transformed_x, transformed_y, 0, 1); |
| 49 } | 49 } |
| 50 | 50 |
| 51 double transformed_x = x() * matrix->m11() + y() * matrix->m21() + | 51 double transformed_x = x() * matrix->m11() + y() * matrix->m21() + |
| 52 z() * matrix->m31() + w() * matrix->m41(); | 52 z() * matrix->m31() + w() * matrix->m41(); |
| 53 double transformed_y = x() * matrix->m12() + y() * matrix->m22() + | 53 double transformed_y = x() * matrix->m12() + y() * matrix->m22() + |
| 54 z() * matrix->m32() + w() * matrix->m42(); | 54 z() * matrix->m32() + w() * matrix->m42(); |
| 55 double transformed_z = x() * matrix->m13() + y() * matrix->m23() + | 55 double transformed_z = x() * matrix->m13() + y() * matrix->m23() + |
| 56 z() * matrix->m33() + w() * matrix->m43(); | 56 z() * matrix->m33() + w() * matrix->m43(); |
| 57 double transformed_w = x() * matrix->m14() + y() * matrix->m24() + | 57 double transformed_w = x() * matrix->m14() + y() * matrix->m24() + |
| 58 z() * matrix->m34() + w() * matrix->m44(); | 58 z() * matrix->m34() + w() * matrix->m44(); |
| 59 return DOMPoint::Create(transformed_x, transformed_y, transformed_z, | 59 return DOMPoint::Create(transformed_x, transformed_y, transformed_z, |
| 60 transformed_w); | 60 transformed_w); |
| 61 } | 61 } |
| 62 | 62 |
| 63 DOMPointReadOnly::DOMPointReadOnly(double x, double y, double z, double w) | 63 DOMPointReadOnly::DOMPointReadOnly(double x, double y, double z, double w) |
| 64 : x_(x), y_(y), z_(z), w_(w) {} | 64 : x_(x), y_(y), z_(z), w_(w) {} |
| 65 | 65 |
| 66 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |