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

Side by Side Diff: Source/core/svg/SVGMatrix.h

Issue 153883003: [SVG] SVGAnimatedTransform{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove m_zoomAndPan Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGMPathElement.cpp ('k') | Source/core/svg/SVGMatrix.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef SVGMatrix_h
21 #define SVGMatrix_h
22
23 #include "bindings/v8/ExceptionState.h"
24 #include "core/dom/ExceptionCode.h"
25 #include "platform/transforms/AffineTransform.h"
26
27 namespace WebCore {
28
29 // Only used in the bindings.
30 class SVGMatrix : public AffineTransform {
31 public:
32 SVGMatrix() { }
33 SVGMatrix(const AffineTransform& other)
34 : AffineTransform(other)
35 {
36 }
37
38 SVGMatrix(double a, double b, double c, double d, double e, double f)
39 : AffineTransform(a, b, c, d, e, f)
40 {
41 }
42
43 SVGMatrix translate(double tx, double ty)
44 {
45 AffineTransform copy = *this;
46 copy.translate(tx, ty);
47 return static_cast<SVGMatrix>(copy);
48 }
49
50 SVGMatrix scale(double s)
51 {
52 AffineTransform copy = *this;
53 copy.scale(s, s);
54 return static_cast<SVGMatrix>(copy);
55 }
56
57 SVGMatrix scaleNonUniform(double sx, double sy)
58 {
59 AffineTransform copy = *this;
60 copy.scale(sx, sy);
61 return static_cast<SVGMatrix>(copy);
62 }
63
64 SVGMatrix rotate(double d)
65 {
66 AffineTransform copy = *this;
67 copy.rotate(d);
68 return static_cast<SVGMatrix>(copy);
69 }
70
71 SVGMatrix flipX()
72 {
73 AffineTransform copy = *this;
74 copy.flipX();
75 return static_cast<SVGMatrix>(copy);
76 }
77
78 SVGMatrix flipY()
79 {
80 AffineTransform copy = *this;
81 copy.flipY();
82 return static_cast<SVGMatrix>(copy);
83 }
84
85 SVGMatrix skewX(double angle)
86 {
87 AffineTransform copy = *this;
88 copy.skewX(angle);
89 return static_cast<SVGMatrix>(copy);
90 }
91
92 SVGMatrix skewY(double angle)
93 {
94 AffineTransform copy = *this;
95 copy.skewY(angle);
96 return static_cast<SVGMatrix>(copy);
97 }
98
99 SVGMatrix multiply(const SVGMatrix& other)
100 {
101 AffineTransform copy = *this;
102 copy *= static_cast<const AffineTransform&>(other);
103 return static_cast<SVGMatrix>(copy);
104 }
105
106 SVGMatrix inverse(ExceptionState& exceptionState) const
107 {
108 AffineTransform transform = AffineTransform::inverse();
109 if (!isInvertible())
110 exceptionState.throwDOMException(InvalidStateError, "The matrix is n ot invertible.");
111
112 return transform;
113 }
114
115 SVGMatrix rotateFromVector(double x, double y, ExceptionState& exceptionStat e)
116 {
117 if (!x || !y)
118 exceptionState.throwDOMException(InvalidAccessError, "Arguments cann ot be zero.");
119
120 AffineTransform copy = *this;
121 copy.rotateFromVector(x, y);
122 return static_cast<SVGMatrix>(copy);
123 }
124
125 };
126
127 } // namespace WebCore
128
129 #endif
OLDNEW
« no previous file with comments | « Source/core/svg/SVGMPathElement.cpp ('k') | Source/core/svg/SVGMatrix.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698