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

Unified Diff: ui/gfx/geometry/safe_integer_conversions.h

Issue 584503005: Make scroll offset type of float in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: link crbug to TODO Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/geometry/BUILD.gn ('k') | ui/gfx/geometry/safe_integer_conversions_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/safe_integer_conversions.h
diff --git a/ui/gfx/geometry/safe_integer_conversions.h b/ui/gfx/geometry/safe_integer_conversions.h
index 4d289ecabafb665386b25ea58704cea22d737440..58ed2a9336ea12a2d2e632d13b50851cdcad83b8 100644
--- a/ui/gfx/geometry/safe_integer_conversions.h
+++ b/ui/gfx/geometry/safe_integer_conversions.h
@@ -30,6 +30,14 @@ inline int ToCeiledInt(float value) {
return ClampToInt(std::ceil(value));
}
+inline int ToFlooredInt(double value) {
+ return ClampToInt(std::floor(value));
+}
+
+inline int ToCeiledInt(double value) {
+ return ClampToInt(std::ceil(value));
+}
+
inline int ToRoundedInt(float value) {
float rounded;
if (value >= 0.0f)
« no previous file with comments | « ui/gfx/geometry/BUILD.gn ('k') | ui/gfx/geometry/safe_integer_conversions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698