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

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

Issue 450533006: Implement scale*() methods 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 27 matching lines...) Expand all
38 m_is2D = false; 38 m_is2D = false;
39 39
40 if (m_is2D) 40 if (m_is2D)
41 m_matrix.translate(tx, ty); 41 m_matrix.translate(tx, ty);
42 else 42 else
43 m_matrix.translate3d(tx, ty, tz); 43 m_matrix.translate3d(tx, ty, tz);
44 44
45 return this; 45 return this;
46 } 46 }
47 47
48 DOMMatrix* DOMMatrix::scaleSelf(double scale, double ox, double oy)
49 {
50 return scaleNonUniformSelf(scale, scale, 1, ox, oy);
51 }
52
53 DOMMatrix* DOMMatrix::scale3dSelf(double scale, double ox, double oy, double oz)
54 {
55 return scaleNonUniformSelf(scale, scale, scale, ox, oy, oz);
56 }
57
58 DOMMatrix* DOMMatrix::scaleNonUniformSelf(double sx, double sy, double sz,
59 double ox, double oy, double oz)
60 {
61 if (sz != 1 || oz)
62 m_is2D = false;
63
64 if (sx == 1 && sy == 1 && sz == 1)
65 return this;
66
67 bool hasTranslation = (ox || oy || oz);
68
69 if (hasTranslation)
70 translateSelf(ox, oy, oz);
71
72 if (m_is2D)
73 m_matrix.scaleNonUniform(sx, sy);
74 else
75 m_matrix.scale3d(sx, sy, sz);
76
77 if (hasTranslation)
78 translateSelf(-ox, -oy, -oz);
79
80 return this;
81 }
82
48 } // namespace blink 83 } // 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