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

Unified Diff: ui/gfx/rect_conversions.cc

Issue 14195014: ui: Use RectF::x/y/right/bottom for rect conversions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/rect_conversions.cc
diff --git a/ui/gfx/rect_conversions.cc b/ui/gfx/rect_conversions.cc
index c0391b3d03953d1d1a5817752f73054d35eaff66..9fbaa5f619022b5f4903d9039bf449bbc8d5eb70 100644
--- a/ui/gfx/rect_conversions.cc
+++ b/ui/gfx/rect_conversions.cc
@@ -12,30 +12,30 @@
namespace gfx {
Rect ToEnclosingRect(const RectF& rect) {
- int min_x = ToFlooredInt(rect.origin().x());
- int min_y = ToFlooredInt(rect.origin().y());
- float max_x = rect.origin().x() + rect.size().width();
- float max_y = rect.origin().y() + rect.size().height();
+ int min_x = ToFlooredInt(rect.x());
+ int min_y = ToFlooredInt(rect.y());
+ float max_x = rect.right();
+ float max_y = rect.bottom();
int width = std::max(ToCeiledInt(max_x) - min_x, 0);
int height = std::max(ToCeiledInt(max_y) - min_y, 0);
return Rect(min_x, min_y, width, height);
}
Rect ToEnclosedRect(const RectF& rect) {
- int min_x = ToCeiledInt(rect.origin().x());
- int min_y = ToCeiledInt(rect.origin().y());
- float max_x = rect.origin().x() + rect.size().width();
- float max_y = rect.origin().y() + rect.size().height();
+ int min_x = ToCeiledInt(rect.x());
+ int min_y = ToCeiledInt(rect.y());
+ float max_x = rect.right();
+ float max_y = rect.bottom();
int width = std::max(ToFlooredInt(max_x) - min_x, 0);
int height = std::max(ToFlooredInt(max_y) - min_y, 0);
return Rect(min_x, min_y, width, height);
}
Rect ToNearestRect(const RectF& rect) {
- float float_min_x = rect.origin().x();
- float float_min_y = rect.origin().y();
- float float_max_x = float_min_x + rect.size().width();
- float float_max_y = float_min_y + rect.size().height();
+ float float_min_x = rect.x();
+ float float_min_y = rect.y();
+ float float_max_x = rect.right();
+ float float_max_y = rect.bottom();
int min_x = ToRoundedInt(float_min_x);
int min_y = ToRoundedInt(float_min_y);
@@ -53,10 +53,10 @@ Rect ToNearestRect(const RectF& rect) {
}
Rect ToFlooredRectDeprecated(const RectF& rect) {
- return Rect(ToFlooredInt(rect.origin().x()),
- ToFlooredInt(rect.origin().y()),
- ToFlooredInt(rect.size().width()),
- ToFlooredInt(rect.size().height()));
+ return Rect(ToFlooredInt(rect.x()),
+ ToFlooredInt(rect.y()),
+ ToFlooredInt(rect.right()),
danakj 2013/04/17 21:13:06 wait, this one is width.
reveman 2013/04/17 21:19:25 Done.
+ ToFlooredInt(rect.bottom()));
}
} // namespace gfx
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698