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

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

Issue 479863002: Implement rotate*() methods in DOMMatrix. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add rotateFromVector and rotateAxisAngle Created 6 years, 4 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 | « Source/core/dom/DOMMatrix.h ('k') | Source/core/dom/DOMMatrix.idl » ('j') | 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 "config.h" 5 #include "config.h"
6 #include "core/dom/DOMMatrix.h" 6 #include "core/dom/DOMMatrix.h"
7 7
8 namespace blink { 8 namespace blink {
9 9
10 DOMMatrix* DOMMatrix::create() 10 DOMMatrix* DOMMatrix::create()
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 m_matrix.scaleNonUniform(sx, sy); 73 m_matrix.scaleNonUniform(sx, sy);
74 else 74 else
75 m_matrix.scale3d(sx, sy, sz); 75 m_matrix.scale3d(sx, sy, sz);
76 76
77 if (hasTranslation) 77 if (hasTranslation)
78 translateSelf(-ox, -oy, -oz); 78 translateSelf(-ox, -oy, -oz);
79 79
80 return this; 80 return this;
81 } 81 }
82 82
83 DOMMatrix* DOMMatrix::rotateSelf(double angle, double ox, double oy)
84 {
85 bool hasTranslation = (ox || oy);
86
87 if (hasTranslation)
88 translateSelf(ox, oy);
89
90 m_matrix.rotate(angle);
91
92 if (hasTranslation)
93 translateSelf(-ox, -oy);
94
95 return this;
96 }
97
98 DOMMatrix* DOMMatrix::rotateFromVectorSelf(double x, double y)
99 {
100 m_matrix.rotateFromVector(x, y);
101
102 return this;
103 }
104
105 DOMMatrix* DOMMatrix::rotateAxisAngleSelf(
106 double x, double y, double z, double angle)
107 {
108 if (x != 0 || y != 0)
zino 2014/08/17 15:32:50 http://dev.w3.org/fxtf/geometry/#dom-dommatrix-rot
109 m_is2D = false;
110
111 m_matrix.rotate3d(x, y, z, angle);
112
113 return this;
114 }
115
83 } // namespace blink 116 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/DOMMatrix.h ('k') | Source/core/dom/DOMMatrix.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698