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

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

Issue 1186133003: gfx: Fix ToEnclosing/ToEnclosed math to deal with big numbers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move function Created 5 years, 6 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 | « no previous file | ui/gfx/geometry/rect.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/rect.h
diff --git a/ui/gfx/geometry/rect.h b/ui/gfx/geometry/rect.h
index 241ff3cf2d1d941732ddb6332a85bfe530b6c128..95251e931122887261cd0927318d0c52a8f04807 100644
--- a/ui/gfx/geometry/rect.h
+++ b/ui/gfx/geometry/rect.h
@@ -245,6 +245,15 @@ inline Rect ScaleToEnclosingRect(const Rect& rect, float scale) {
return ScaleToEnclosingRect(rect, scale, scale);
}
+// Returns the smallest Rect that encloses the given Rect after scaling by
+// scale. If the result is scaling would make any dimension of the rect be too
danakj 2015/06/15 19:13:47 result from
+// big to be represented by an integer, then use the largest integer for that
+// dimension.
+// Note that the resulting rect x(), y(), width(), height(), right(), bottom()
+// will all return valid integer values. This means that if x() is max_int,
+// then width would() have to be 0 in order for right() to be max_int.
+GFX_EXPORT Rect SafelyScaleToEnclosingRect(const Rect& rect, float scale);
danakj 2015/06/15 19:13:47 Should we be returning a bool equivalent of |clipp
+
inline Rect ScaleToEnclosedRect(const Rect& rect,
float x_scale,
float y_scale) {
« no previous file with comments | « no previous file | ui/gfx/geometry/rect.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698