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

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

Issue 135183016: Revert of Pinch/Zoom Infrastructure & Plumbing CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // the result to |this|. 82 // the result to |this|.
83 void RotateAboutXAxis(double degrees); 83 void RotateAboutXAxis(double degrees);
84 void RotateAboutYAxis(double degrees); 84 void RotateAboutYAxis(double degrees);
85 void RotateAboutZAxis(double degrees); 85 void RotateAboutZAxis(double degrees);
86 void RotateAbout(const Vector3dF& axis, double degrees); 86 void RotateAbout(const Vector3dF& axis, double degrees);
87 87
88 // Applies the current transformation on a scaling and assigns the result 88 // Applies the current transformation on a scaling and assigns the result
89 // to |this|. 89 // to |this|.
90 void Scale(SkMScalar x, SkMScalar y); 90 void Scale(SkMScalar x, SkMScalar y);
91 void Scale3d(SkMScalar x, SkMScalar y, SkMScalar z); 91 void Scale3d(SkMScalar x, SkMScalar y, SkMScalar z);
92 gfx::Vector2dF Scale2d() const {
93 return gfx::Vector2dF(matrix_.get(0,0), matrix_.get(1,1));
94 }
95 92
96 // Applies the current transformation on a translation and assigns the result 93 // Applies the current transformation on a translation and assigns the result
97 // to |this|. 94 // to |this|.
98 void Translate(SkMScalar x, SkMScalar y); 95 void Translate(SkMScalar x, SkMScalar y);
99 void Translate3d(SkMScalar x, SkMScalar y, SkMScalar z); 96 void Translate3d(SkMScalar x, SkMScalar y, SkMScalar z);
100 97
101 // Applies the current transformation on a skew and assigns the result 98 // Applies the current transformation on a skew and assigns the result
102 // to |this|. 99 // to |this|.
103 void SkewX(double angle_x); 100 void SkewX(double angle_x);
104 void SkewY(double angle_y); 101 void SkewY(double angle_y);
(...skipping 27 matching lines...) Expand all
132 if (!IsScaleOrTranslation()) 129 if (!IsScaleOrTranslation())
133 return false; 130 return false;
134 return matrix_.get(0, 0) > 0.0 && matrix_.get(1, 1) > 0.0 && 131 return matrix_.get(0, 0) > 0.0 && matrix_.get(1, 1) > 0.0 &&
135 matrix_.get(2, 2) > 0.0; 132 matrix_.get(2, 2) > 0.0;
136 } 133 }
137 134
138 // Returns true if the matrix is either identity or pure, non-fractional 135 // Returns true if the matrix is either identity or pure, non-fractional
139 // translation. 136 // translation.
140 bool IsIdentityOrIntegerTranslation() const; 137 bool IsIdentityOrIntegerTranslation() const;
141 138
142 // Returns true if the matrix had only scaling components.
143 bool IsScale2d() const {
144 return !(matrix_.getType() & ~SkMatrix44::kScale_Mask);
145 }
146
147 // Returns true if the matrix is has only scaling and translation components. 139 // Returns true if the matrix is has only scaling and translation components.
148 bool IsScaleOrTranslation() const { 140 bool IsScaleOrTranslation() const {
149 int mask = SkMatrix44::kScale_Mask | SkMatrix44::kTranslate_Mask; 141 int mask = SkMatrix44::kScale_Mask | SkMatrix44::kTranslate_Mask;
150 return (matrix_.getType() & ~mask) == 0; 142 return (matrix_.getType() & ~mask) == 0;
151 } 143 }
152 144
153 // Returns true if axis-aligned 2d rects will remain axis-aligned after being 145 // Returns true if axis-aligned 2d rects will remain axis-aligned after being
154 // transformed by this matrix. 146 // transformed by this matrix.
155 bool Preserves2dAxisAlignment() const; 147 bool Preserves2dAxisAlignment() const;
156 148
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 Point3F* point) const; 256 Point3F* point) const;
265 257
266 SkMatrix44 matrix_; 258 SkMatrix44 matrix_;
267 259
268 // copy/assign are allowed. 260 // copy/assign are allowed.
269 }; 261 };
270 262
271 } // namespace gfx 263 } // namespace gfx
272 264
273 #endif // UI_GFX_TRANSFORM_H_ 265 #endif // UI_GFX_TRANSFORM_H_
OLDNEW
« no previous file with comments | « content/test/web_layer_tree_view_impl_for_testing.cc ('k') | webkit/renderer/compositor_bindings/web_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698