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

Unified Diff: ui/gfx/point_base.h

Issue 11361186: ui: Add methods to clamp Sizes, Points, and Vectors from above or below. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: BottomRight Created 8 years, 1 month 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/point_base.h
diff --git a/ui/gfx/point_base.h b/ui/gfx/point_base.h
index acaefe17805df6bbc2aa241805175eedea6c6656..24ce5f2195eb46f7454fcf9caf612f5080d4328e 100644
--- a/ui/gfx/point_base.h
+++ b/ui/gfx/point_base.h
@@ -41,6 +41,16 @@ class UI_EXPORT PointBase {
Offset(-other.x(), -other.y());
}
+ void ClampFromAbove(const Class& other) {
sky 2012/11/09 18:23:12 Is there some other name we could use for these th
+ x_ = x_ <= other.x_ ? x_ : other.x_;
+ y_ = y_ <= other.y_ ? y_ : other.y_;
+ }
+
+ void ClampFromBelow(const Class& other) {
+ x_ = x_ >= other.x_ ? x_ : other.x_;
+ y_ = y_ >= other.y_ ? y_ : other.y_;
+ }
+
Class Add(const VectorClass& other) const WARN_UNUSED_RESULT {
const Class* orig = static_cast<const Class*>(this);
Class copy = *orig;
« no previous file with comments | « cc/tiled_layer.cc ('k') | ui/gfx/point_unittest.cc » ('j') | ui/gfx/size_base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698