Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: third_party/WebKit/Source/core/geometry/DOMPointReadOnly.cpp

Issue 2930883002: [geometry] replace m12 with m21 when transform DOMPoint from DOMMatrix. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698