OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef UI_GFX_TRANSFORM_H_ | 5 #ifndef UI_GFX_TRANSFORM_H_ |
6 #define UI_GFX_TRANSFORM_H_ | 6 #define UI_GFX_TRANSFORM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // transforms would have on z values. | 175 // transforms would have on z values. |
176 // | 176 // |
177 void FlattenTo2d(); | 177 void FlattenTo2d(); |
178 | 178 |
179 // Returns the translation components of the matrix. It is an error to call | 179 // Returns the translation components of the matrix. It is an error to call |
180 // this function if the transform does not represent only a 2d translation. | 180 // this function if the transform does not represent only a 2d translation. |
181 Vector2dF To2dTranslation() const; | 181 Vector2dF To2dTranslation() const; |
182 | 182 |
183 // Applies the transformation on the point. Returns true if the point is | 183 // Applies the transformation on the point. Returns true if the point is |
184 // transformed successfully. | 184 // transformed successfully. |
185 void TransformPoint(Point3F& point) const; | 185 void TransformPoint(Point3F* point) const; |
186 | 186 |
187 // Applies the transformation on the point. Returns true if the point is | 187 // Applies the transformation on the point. Returns true if the point is |
188 // transformed successfully. Rounds the result to the nearest point. | 188 // transformed successfully. Rounds the result to the nearest point. |
189 void TransformPoint(Point& point) const; | 189 void TransformPoint(Point* point) const; |
190 | 190 |
191 // Applies the reverse transformation on the point. Returns true if the | 191 // Applies the reverse transformation on the point. Returns true if the |
192 // transformation can be inverted. | 192 // transformation can be inverted. |
193 bool TransformPointReverse(Point3F& point) const; | 193 bool TransformPointReverse(Point3F* point) const; |
194 | 194 |
195 // Applies the reverse transformation on the point. Returns true if the | 195 // Applies the reverse transformation on the point. Returns true if the |
196 // transformation can be inverted. Rounds the result to the nearest point. | 196 // transformation can be inverted. Rounds the result to the nearest point. |
197 bool TransformPointReverse(Point& point) const; | 197 bool TransformPointReverse(Point* point) const; |
198 | 198 |
199 // Applies transformation on the rectangle. Returns true if the transformed | 199 // Applies transformation on the rectangle. Returns true if the transformed |
200 // rectangle was axis aligned. If it returns false, rect will be the | 200 // rectangle was axis aligned. If it returns false, rect will be the |
201 // smallest axis aligned bounding box containing the transformed rect. | 201 // smallest axis aligned bounding box containing the transformed rect. |
202 void TransformRect(RectF* rect) const; | 202 void TransformRect(RectF* rect) const; |
203 | 203 |
204 // Applies the reverse transformation on the rectangle. Returns true if | 204 // Applies the reverse transformation on the rectangle. Returns true if |
205 // the transformed rectangle was axis aligned. If it returns false, | 205 // the transformed rectangle was axis aligned. If it returns false, |
206 // rect will be the smallest axis aligned bounding box containing the | 206 // rect will be the smallest axis aligned bounding box containing the |
207 // transformed rect. | 207 // transformed rect. |
(...skipping 22 matching lines...) Expand all Loading... |
230 } | 230 } |
231 | 231 |
232 // Returns the underlying matrix. | 232 // Returns the underlying matrix. |
233 const SkMatrix44& matrix() const { return matrix_; } | 233 const SkMatrix44& matrix() const { return matrix_; } |
234 SkMatrix44& matrix() { return matrix_; } | 234 SkMatrix44& matrix() { return matrix_; } |
235 | 235 |
236 std::string ToString() const; | 236 std::string ToString() const; |
237 | 237 |
238 private: | 238 private: |
239 void TransformPointInternal(const SkMatrix44& xform, | 239 void TransformPointInternal(const SkMatrix44& xform, |
240 Point& point) const; | 240 Point* point) const; |
241 | 241 |
242 void TransformPointInternal(const SkMatrix44& xform, | 242 void TransformPointInternal(const SkMatrix44& xform, |
243 Point3F& point) const; | 243 Point3F* point) const; |
244 | 244 |
245 SkMatrix44 matrix_; | 245 SkMatrix44 matrix_; |
246 | 246 |
247 // copy/assign are allowed. | 247 // copy/assign are allowed. |
248 }; | 248 }; |
249 | 249 |
250 } // namespace gfx | 250 } // namespace gfx |
251 | 251 |
252 #endif // UI_GFX_TRANSFORM_H_ | 252 #endif // UI_GFX_TRANSFORM_H_ |
OLD | NEW |