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

Side by Side Diff: cc/base/math_util.h

Issue 27223008: Provide approximate type functions for SkMatrix44. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename functions taking gfx::Transform. Created 7 years, 2 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
« no previous file with comments | « no previous file | cc/base/math_util.cc » ('j') | cc/base/math_util.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 CC_BASE_MATH_UTIL_H_ 5 #ifndef CC_BASE_MATH_UTIL_H_
6 #define CC_BASE_MATH_UTIL_H_ 6 #define CC_BASE_MATH_UTIL_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 static bool FromValue(const base::Value*, gfx::Rect* out_rect); 170 static bool FromValue(const base::Value*, gfx::Rect* out_rect);
171 static scoped_ptr<base::Value> AsValue(gfx::PointF q); 171 static scoped_ptr<base::Value> AsValue(gfx::PointF q);
172 static scoped_ptr<base::Value> AsValue(const gfx::QuadF& q); 172 static scoped_ptr<base::Value> AsValue(const gfx::QuadF& q);
173 static scoped_ptr<base::Value> AsValue(const gfx::RectF& rect); 173 static scoped_ptr<base::Value> AsValue(const gfx::RectF& rect);
174 static scoped_ptr<base::Value> AsValue(const gfx::Transform& transform); 174 static scoped_ptr<base::Value> AsValue(const gfx::Transform& transform);
175 175
176 // Returns a base::Value representation of the floating point value. 176 // Returns a base::Value representation of the floating point value.
177 // If the value is inf, returns max double/float representation. 177 // If the value is inf, returns max double/float representation.
178 static scoped_ptr<base::Value> AsValueSafely(double value); 178 static scoped_ptr<base::Value> AsValueSafely(double value);
179 static scoped_ptr<base::Value> AsValueSafely(float value); 179 static scoped_ptr<base::Value> AsValueSafely(float value);
180
181 // Check if matrices are of a certain type using approximate math. Each
182 // function gets a tolerance parameter to specify the maximum allowed
183 // absolute difference to the exact values.
184 static bool IsApproximatelyPureTranslation(
185 const gfx::Transform& transform, SkMScalar tolerance);
186 static bool IsMatrixApproximatelyPureTranslation(
187 const SkMatrix44& matrix, SkMScalar tolerance);
188 static bool IsApproximatelyIntegerTransform(
189 const gfx::Transform& transform, SkMScalar tolerance);
190 static bool IsMatrixApproximatelyIntegerTransform(
191 const SkMatrix44& matrix, SkMScalar tolerance);
180 }; 192 };
181 193
182 } // namespace cc 194 } // namespace cc
183 195
184 #endif // CC_BASE_MATH_UTIL_H_ 196 #endif // CC_BASE_MATH_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | cc/base/math_util.cc » ('j') | cc/base/math_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698