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

Side by Side Diff: third_party/WebKit/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "TransformationMatrix.h" 27 #include "TransformationMatrix.h"
28 28
29 #include "IntRect.h" 29 #include "IntRect.h"
30 #include "FloatRect.h" 30 #include "FloatRect.h"
31 31
32 namespace WebCore { 32 namespace WebCore {
33 33
34 TransformationMatrix::TransformationMatrix()
35 : m_transform()
36 {
37 }
38
39 TransformationMatrix::TransformationMatrix(double a, double b, double c, double d, double tx, double ty)
40 : m_transform(a, b, c, d, tx, ty)
41 {
42 }
43
44 TransformationMatrix::TransformationMatrix(const PlatformTransformationMatrix& m atrix)
45 : m_transform(matrix)
46 {
47 }
48
49 void TransformationMatrix::setMatrix(double a, double b, double c, double d, dou ble tx, double ty)
50 {
51 m_transform.setMatrix(a, b, c, d, tx, ty);
52 }
53
54 void TransformationMatrix::map(double x, double y, double* x2, double* y2) const
55 {
56 qreal tx2, ty2;
57 m_transform.map(qreal(x), qreal(y), &tx2, &ty2);
58 *x2 = tx2;
59 *y2 = ty2;
60 }
61
62 IntRect TransformationMatrix::mapRect(const IntRect& rect) const
63 {
64 return m_transform.mapRect(rect);
65 }
66
67 FloatRect TransformationMatrix::mapRect(const FloatRect& rect) const
68 {
69 return m_transform.mapRect(rect);
70 }
71
72 bool TransformationMatrix::isIdentity() const
73 {
74 return m_transform.isIdentity();
75 }
76
77 double TransformationMatrix::a() const
78 {
79 return m_transform.m11();
80 }
81
82 void TransformationMatrix::setA(double a)
83 {
84 m_transform.setMatrix(a, b(), c(), d(), e(), f());
85 }
86
87 double TransformationMatrix::b() const
88 {
89 return m_transform.m12();
90 }
91
92 void TransformationMatrix::setB(double b)
93 {
94 m_transform.setMatrix(a(), b, c(), d(), e(), f());
95 }
96
97 double TransformationMatrix::c() const
98 {
99 return m_transform.m21();
100 }
101
102 void TransformationMatrix::setC(double c)
103 {
104 m_transform.setMatrix(a(), b(), c, d(), e(), f());
105 }
106
107 double TransformationMatrix::d() const
108 {
109 return m_transform.m22();
110 }
111
112 void TransformationMatrix::setD(double d)
113 {
114 m_transform.setMatrix(a(), b(), c(), d, e(), f());
115 }
116
117 double TransformationMatrix::e() const
118 {
119 return m_transform.dx();
120 }
121
122 void TransformationMatrix::setE(double e)
123 {
124 m_transform.setMatrix(a(), b(), c(), d(), e, f());
125 }
126
127 double TransformationMatrix::f() const
128 {
129 return m_transform.dy();
130 }
131
132 void TransformationMatrix::setF(double f)
133 {
134 m_transform.setMatrix(a(), b(), c(), d(), e(), f);
135 }
136
137 void TransformationMatrix::reset()
138 {
139 m_transform.reset();
140 }
141
142 TransformationMatrix& TransformationMatrix::scale(double sx, double sy)
143 {
144 m_transform.scale(sx, sy);
145 return *this;
146 }
147
148 TransformationMatrix& TransformationMatrix::rotate(double d)
149 {
150 m_transform.rotate(d);
151 return *this;
152 }
153
154 TransformationMatrix& TransformationMatrix::translate(double tx, double ty)
155 {
156 m_transform.translate(tx, ty);
157 return *this;
158 }
159
160 TransformationMatrix& TransformationMatrix::shear(double sx, double sy)
161 {
162 m_transform.shear(sx, sy);
163 return *this;
164 }
165
166 double TransformationMatrix::det() const
167 {
168 return m_transform.det();
169 }
170
171 TransformationMatrix TransformationMatrix::inverse() const
172 {
173 if(!isInvertible())
174 return TransformationMatrix();
175
176 return m_transform.inverted();
177 }
178
179 TransformationMatrix::operator QMatrix() const 34 TransformationMatrix::operator QMatrix() const
180 { 35 {
181 return m_transform; 36 return QMatrix(a(), b(), c(), d(), e(), f());
182 }
183
184 bool TransformationMatrix::operator==(const TransformationMatrix& other) const
185 {
186 return m_transform == other.m_transform;
187 }
188
189 TransformationMatrix& TransformationMatrix::operator*=(const TransformationMatri x& other)
190 {
191 m_transform *= other.m_transform;
192 return *this;
193 }
194
195 TransformationMatrix TransformationMatrix::operator*(const TransformationMatrix& other)
196 {
197 return m_transform * other.m_transform;
198 } 37 }
199 38
200 } 39 }
201 40
202 // vim: ts=4 sw=4 et 41 // vim: ts=4 sw=4 et
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698