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

Unified Diff: ui/gfx/rect.h

Issue 10993094: Make adding and subtracting gfx:: point types simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
Index: ui/gfx/rect.h
diff --git a/ui/gfx/rect.h b/ui/gfx/rect.h
index 64f35b1fe8adde6d9b0e0de6e01b1501ce7e71d3..6c812f87279aa756d7949236422b3d6847a88950 100644
--- a/ui/gfx/rect.h
+++ b/ui/gfx/rect.h
@@ -68,19 +68,19 @@ class UI_EXPORT Rect : public RectBase<Rect, Point, Size, Insets, int> {
CGRect ToCGRect() const;
#endif
- RectF ToRectF() const WARN_UNUSED_RESULT {
- return RectF(origin().x(), origin().y(), size().width(), size().height());
- }
-
RectF Scale(float scale) const WARN_UNUSED_RESULT {
return Scale(scale, scale);
}
RectF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT {
- return ToRectF().Scale(x_scale, y_scale);
+ return static_cast<RectF>(*this).Scale(x_scale, y_scale);
}
std::string ToString() const;
+
+ operator RectF() const {
sky 2012/10/01 21:02:20 Why is this better than ToRectF?
danakj 2012/10/01 21:55:34 So you don't have to cast all the ints to floats e
+ return RectF(origin().x(), origin().y(), size().width(), size().height());
+ }
};
#if !defined(COMPILER_MSVC)

Powered by Google App Engine
This is Rietveld 408576698