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

Unified Diff: ui/gfx/rect.h

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.h
diff --git a/ui/gfx/rect.h b/ui/gfx/rect.h
index 652c019ea6abdfa9351096efef9fd7225d61d701..34c82b03e795b779aa689359a45a4f084f689059 100644
--- a/ui/gfx/rect.h
+++ b/ui/gfx/rect.h
@@ -16,6 +16,7 @@
#include "ui/gfx/point.h"
#include "ui/gfx/rect_base.h"
+#include "ui/gfx/rect_f.h"
#include "ui/gfx/size.h"
#if defined(OS_WIN)
@@ -67,6 +68,24 @@ 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());
+ }
+
+ // This fuction is retained to maintain the old behavior, but should never be
+ // used. Every instance of ScaleUnsafe should be replaced with a Scale
+ // followed by ToEnclosingRect or ToEnclosedRect as appropriate.
+ Rect ScaleUnsafe(float scale) const WARN_UNUSED_RESULT;
sky 2012/09/27 17:48:30 Why do we need these? Can't we pick one and make S
+ Rect ScaleUnsafe(float x_scale, float y_scale) const WARN_UNUSED_RESULT;
+
+ 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);
+ }
+
std::string ToString() const;
};
« no previous file with comments | « ui/gfx/image/image_skia_operations.cc ('k') | ui/gfx/rect.cc » ('j') | ui/gfx/size_base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698