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

Side by Side Diff: ui/gfx/transform.h

Issue 11275089: SkRect to gfx::Rect type conversions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
OLDNEW
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 "third_party/skia/include/utils/SkMatrix44.h" 8 #include "third_party/skia/include/utils/SkMatrix44.h"
9 #include "ui/base/ui_export.h" 9 #include "ui/base/ui_export.h"
10 10
11 namespace gfx { 11 namespace gfx {
12 12
13 class Rect; 13 class Rect;
14 class RectF;
14 class Point; 15 class Point;
15 class Point3F; 16 class Point3F;
16 17
17 // 4x4 transformation matrix. Transform is cheap and explicitly allows 18 // 4x4 transformation matrix. Transform is cheap and explicitly allows
18 // copy/assign. 19 // copy/assign.
19 class UI_EXPORT Transform { 20 class UI_EXPORT Transform {
20 public: 21 public:
21 Transform(); 22 Transform();
22 ~Transform(); 23 ~Transform();
23 24
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // transformation can be inverted. 96 // transformation can be inverted.
96 bool TransformPointReverse(Point3F& point) const; 97 bool TransformPointReverse(Point3F& point) const;
97 98
98 // Applies the reverse transformation on the point. Returns true if the 99 // Applies the reverse transformation on the point. Returns true if the
99 // transformation can be inverted. Rounds the result to the nearest point. 100 // transformation can be inverted. Rounds the result to the nearest point.
100 bool TransformPointReverse(Point& point) const; 101 bool TransformPointReverse(Point& point) const;
101 102
102 // Applies transformation on the rectangle. Returns true if the transformed 103 // Applies transformation on the rectangle. Returns true if the transformed
103 // rectangle was axis aligned. If it returns false, rect will be the 104 // rectangle was axis aligned. If it returns false, rect will be the
104 // smallest axis aligned bounding box containing the transformed rect. 105 // smallest axis aligned bounding box containing the transformed rect.
106 void TransformRect(RectF* rect) const;
danakj 2012/11/01 00:37:00 Why the transform changes in this CL? I think they
107
108 // Same as above, but expands to enclosing int rect.
danakj 2012/11/01 00:37:00 Not sure if implicit enclosing is great either. I
105 void TransformRect(Rect* rect) const; 109 void TransformRect(Rect* rect) const;
106 110
107 // Applies the reverse transformation on the rectangle. Returns true if 111 // Applies the reverse transformation on the rectangle. Returns true if
108 // the transformed rectangle was axis aligned. If it returns false, 112 // the transformed rectangle was axis aligned. If it returns false,
109 // rect will be the smallest axis aligned bounding box containing the 113 // rect will be the smallest axis aligned bounding box containing the
110 // transformed rect. 114 // transformed rect.
111 bool TransformRectReverse(Rect* rect) const; 115 bool TransformRectReverse(RectF* rect) const;
116
117 // Same as above, but expands to enclosing int rect.
118 void TransformRectReverse(Rect* rect) const;
112 119
113 // Returns the underlying matrix. 120 // Returns the underlying matrix.
114 const SkMatrix44& matrix() const { return matrix_; } 121 const SkMatrix44& matrix() const { return matrix_; }
115 SkMatrix44& matrix() { return matrix_; } 122 SkMatrix44& matrix() { return matrix_; }
116 123
117 private: 124 private:
118 void TransformPointInternal(const SkMatrix44& xform, 125 void TransformPointInternal(const SkMatrix44& xform,
119 Point& point) const; 126 Point& point) const;
120 127
121 void TransformPointInternal(const SkMatrix44& xform, 128 void TransformPointInternal(const SkMatrix44& xform,
122 Point3F& point) const; 129 Point3F& point) const;
123 130
124 SkMatrix44 matrix_; 131 SkMatrix44 matrix_;
125 132
126 // copy/assign are allowed. 133 // copy/assign are allowed.
127 }; 134 };
128 135
129 } // namespace gfx 136 } // namespace gfx
130 137
131 #endif // UI_GFX_TRANSFORM_H_ 138 #endif // UI_GFX_TRANSFORM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698