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

Unified Diff: ui/gfx/rect_f.h

Issue 12084031: A host of micro-optimizations and a refactor of TimeForBoundsToIntersect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebasing to tip of tree Created 7 years, 11 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 | « cc/tile_priority_unittest.cc ('k') | ui/gfx/rect_f.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/rect_f.h
diff --git a/ui/gfx/rect_f.h b/ui/gfx/rect_f.h
index 78524a07587d609c0c0bc3b9f9c851a23ab4df69..62bedf2e3593d40c3a7cc008d6021a651462f17d 100644
--- a/ui/gfx/rect_f.h
+++ b/ui/gfx/rect_f.h
@@ -69,8 +69,15 @@ inline bool operator!=(const RectF& lhs, const RectF& rhs) {
return !(lhs == rhs);
}
-UI_EXPORT RectF operator+(const RectF& lhs, const Vector2dF& rhs);
-UI_EXPORT RectF operator-(const RectF& lhs, const Vector2dF& rhs);
+inline RectF operator+(const RectF& lhs, const Vector2dF& rhs) {
+ return RectF(lhs.x() + rhs.x(), lhs.y() + rhs.y(),
+ lhs.width(), lhs.height());
+}
+
+inline RectF operator-(const RectF& lhs, const Vector2dF& rhs) {
+ return RectF(lhs.x() - rhs.x(), lhs.y() - rhs.y(),
+ lhs.width(), lhs.height());
+}
inline RectF operator+(const Vector2dF& lhs, const RectF& rhs) {
return rhs + lhs;
@@ -79,7 +86,11 @@ inline RectF operator+(const Vector2dF& lhs, const RectF& rhs) {
UI_EXPORT RectF IntersectRects(const RectF& a, const RectF& b);
UI_EXPORT RectF UnionRects(const RectF& a, const RectF& b);
UI_EXPORT RectF SubtractRects(const RectF& a, const RectF& b);
-UI_EXPORT RectF ScaleRect(const RectF& r, float x_scale, float y_scale);
+
+inline RectF ScaleRect(const RectF& r, float x_scale, float y_scale) {
+ return RectF(r.x() * x_scale, r.y() * y_scale,
+ r.width() * x_scale, r.height() * y_scale);
+}
inline RectF ScaleRect(const RectF& r, float scale) {
return ScaleRect(r, scale, scale);
« no previous file with comments | « cc/tile_priority_unittest.cc ('k') | ui/gfx/rect_f.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698