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

Unified Diff: ui/gfx/rect.cc

Issue 10996037: Do not convert from RectF to Rect by flooring. (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.cc
diff --git a/ui/gfx/rect.cc b/ui/gfx/rect.cc
index 8fc2cfbe2785cdf0f4557b920debc4a90f88a28f..bb2723b2136a51902155124847cd3e43a2dacc81 100644
--- a/ui/gfx/rect.cc
+++ b/ui/gfx/rect.cc
@@ -14,6 +14,7 @@
#include "base/stringprintf.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/rect_base_impl.h"
+#include "ui/gfx/rect_conversions.h"
namespace gfx {
@@ -106,6 +107,18 @@ GdkRectangle Rect::ToGdkRectangle() const {
}
#endif
+Rect ToRect(const RectF& rect) {
+ return Rect(rect.origin().ToPoint(), rect.size().ToSize());
+}
+
+Rect Rect::ScaleUnsafe(float scale) const {
+ return ToRect(Scale(scale));
+}
+
+Rect Rect::ScaleUnsafe(float x_scale, float y_scale) const {
+ return ToRect(Scale(x_scale, y_scale));
+}
+
std::string Rect::ToString() const {
return base::StringPrintf("%s %s",
origin().ToString().c_str(),

Powered by Google App Engine
This is Rietveld 408576698