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

Side by Side Diff: third_party/WebKit/Source/core/dom/DOMMatrix.cpp

Issue 2283363004: GeometryInterace: Add rotate methods. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
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/dom/DOMMatrix.h" 5 #include "core/dom/DOMMatrix.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 DOMMatrix* DOMMatrix::create() 9 DOMMatrix* DOMMatrix::create()
10 { 10 {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 m_matrix->scaleNonUniform(sx, sy); 99 m_matrix->scaleNonUniform(sx, sy);
100 else 100 else
101 m_matrix->scale3d(sx, sy, sz); 101 m_matrix->scale3d(sx, sy, sz);
102 102
103 if (hasTranslation) 103 if (hasTranslation)
104 translateSelf(-ox, -oy, -oz); 104 translateSelf(-ox, -oy, -oz);
105 105
106 return this; 106 return this;
107 } 107 }
108 108
109 DOMMatrix* DOMMatrix::rotateSelf(double rotX)
110 {
111 return rotateSelf(0, 0, rotX);
112 }
113
114 DOMMatrix* DOMMatrix::rotateSelf(double rotX, double rotY)
115 {
116 return rotateSelf(rotX, rotY, 0);
117 }
118
119 DOMMatrix* DOMMatrix::rotateSelf(double rotX, double rotY, double rotZ)
120 {
121 if (rotZ)
122 m_matrix->rotate3d(0, 0, 1, rotZ);
123
124 if (rotY) {
125 m_matrix->rotate3d(0, 1, 0, rotY);
126 m_is2D = false;
127 }
128
129 if (rotX) {
130 m_matrix->rotate3d(1, 0, 0, rotX);
131 m_is2D = false;
132 }
133
134 return this;
135 }
136
137 DOMMatrix* DOMMatrix::rotateFromVectorSelf(double x, double y)
138 {
139 m_matrix->rotate(rad2deg(atan2(y, x)));
140 return this;
141 }
142
143 DOMMatrix* DOMMatrix::rotateAxisAngleSelf(double x, double y, double z, double a ngle)
144 {
145 if (x || y)
146 m_is2D = false;
147
148 m_matrix->rotate3d(x, y, z, angle);
149 return this;
150 }
151
109 } // namespace blink 152 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/DOMMatrix.h ('k') | third_party/WebKit/Source/core/dom/DOMMatrix.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698