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

Unified Diff: ui/gfx/rect_f.h

Issue 10996037: Do not convert from RectF to Rect by flooring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing mac build. 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
« no previous file with comments | « ui/gfx/rect_conversions.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 4a2d642fb817d5807bec32d7941a40bc600ef874..4395b523a00fa26f864801e4652e108705fe475f 100644
--- a/ui/gfx/rect_f.h
+++ b/ui/gfx/rect_f.h
@@ -8,7 +8,6 @@
#include <string>
#include "ui/gfx/point_f.h"
-#include "ui/gfx/rect.h"
#include "ui/gfx/rect_base.h"
#include "ui/gfx/size_f.h"
@@ -27,7 +26,16 @@ class UI_EXPORT RectF : public RectBase<RectF, PointF, SizeF, InsetsF, float> {
~RectF();
- Rect ToRect() const;
+ /// Scales the rectangle by |scale|.
+ RectF Scale(float scale) const WARN_UNUSED_RESULT {
+ return Scale(scale, scale);
+ }
+
+ RectF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT {
+ SizeF newSize = size().Scale(x_scale, y_scale);
+ newSize.ClampToNonNegative();
+ return RectF(origin().Scale(x_scale, y_scale), newSize);
+ }
std::string ToString() const;
};
@@ -38,4 +46,4 @@ extern template class RectBase<RectF, PointF, SizeF, InsetsF, float>;
} // namespace gfx
-#endif // UI_GFX_RECT_H_
+#endif // UI_GFX_RECT_F_H_
« no previous file with comments | « ui/gfx/rect_conversions.cc ('k') | ui/gfx/rect_f.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698