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

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

Issue 446803002: Implement translate() and translateSelf() in DOMMatrix. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use TransformationMatrix 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 11 matching lines...) Expand all
22 m_matrix = matrix; 22 m_matrix = matrix;
23 m_is2D = is2D; 23 m_is2D = is2D;
24 } 24 }
25 25
26 void DOMMatrix::setIs2D(bool value) 26 void DOMMatrix::setIs2D(bool value)
27 { 27 {
28 if (m_is2D) 28 if (m_is2D)
29 m_is2D = value; 29 m_is2D = value;
30 } 30 }
31 31
32 DOMMatrix* DOMMatrix::translateSelf(double tx, double ty, double tz)
33 {
34 if (!tx && !ty && !tz)
35 return this;
36
37 if (tz)
38 m_is2D = false;
39
40 if (m_matrix.isIdentity()) {
krit 2014/08/16 07:03:06 Just use translate3d() and translate() don't dupli
zino 2014/08/16 16:50:42 Okay, I agree with you. I'll remove the codes.
41 m_matrix.setM41(tx);
42 m_matrix.setM42(ty);
43 m_matrix.setM43(tz);
44 return this;
45 }
46
47 if (m_is2D) {
48 m_matrix.setM41(m_matrix.m41() + tx * m_matrix.m11() + ty * m_matrix.m21 ());
zino 2014/08/16 16:50:42 However, I think it is better to leave this codes
49 m_matrix.setM42(m_matrix.m42() + tx * m_matrix.m12() + ty * m_matrix.m22 ());
50 return this;
51 }
52
53 m_matrix.translate3d(tx, ty, tz);
54
55 return this;
56 }
57
32 } // namespace blink 58 } // 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