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

Side by Side Diff: ui/gfx/geometry/rect.h

Issue 2042073002: Centered flood fill style ink drop ripples on mouse/touch points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polished for review. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Defines a simple integer rectangle class. The containment semantics 5 // Defines a simple integer rectangle class. The containment semantics
6 // are array-like; that is, the coordinate (x, y) is considered to be 6 // are array-like; that is, the coordinate (x, y) is considered to be
7 // contained by the rectangle, but the coordinate (x + width, y) is not. 7 // contained by the rectangle, but the coordinate (x + width, y) is not.
8 // The class will happily let you create malformed rectangles (that is, 8 // The class will happily let you create malformed rectangles (that is,
9 // rectangles with negative width and/or height), but there will be assertions 9 // rectangles with negative width and/or height), but there will be assertions
10 // in the operations (such as Contains()) to complain in this case. 10 // in the operations (such as Contains()) to complain in this case.
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Returns the manhattan distance from the rect to the point. If the point is 171 // Returns the manhattan distance from the rect to the point. If the point is
172 // inside the rect, returns 0. 172 // inside the rect, returns 0.
173 int ManhattanDistanceToPoint(const Point& point) const; 173 int ManhattanDistanceToPoint(const Point& point) const;
174 174
175 // Returns the manhattan distance between the contents of this rect and the 175 // Returns the manhattan distance between the contents of this rect and the
176 // contents of the given rect. That is, if the intersection of the two rects 176 // contents of the given rect. That is, if the intersection of the two rects
177 // is non-empty then the function returns 0. If the rects share a side, it 177 // is non-empty then the function returns 0. If the rects share a side, it
178 // returns the smallest non-zero value appropriate for int. 178 // returns the smallest non-zero value appropriate for int.
179 int ManhattanInternalDistance(const Rect& rect) const; 179 int ManhattanInternalDistance(const Rect& rect) const;
180 180
181 // Returns the largest distance from |point| to the corners of |this|.
182 float MaxDistanceToCorners(const gfx::Point& point) const;
183
181 std::string ToString() const; 184 std::string ToString() const;
182 185
183 bool ApproximatelyEqual(const Rect& rect, int tolerance) const; 186 bool ApproximatelyEqual(const Rect& rect, int tolerance) const;
184 187
185 private: 188 private:
186 gfx::Point origin_; 189 gfx::Point origin_;
187 gfx::Size size_; 190 gfx::Size size_;
188 }; 191 };
189 192
190 inline bool operator==(const Rect& lhs, const Rect& rhs) { 193 inline bool operator==(const Rect& lhs, const Rect& rhs) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 274 }
272 275
273 // This is declared here for use in gtest-based unit tests but is defined in 276 // This is declared here for use in gtest-based unit tests but is defined in
274 // the gfx_test_support target. Depend on that to use this in your unit test. 277 // the gfx_test_support target. Depend on that to use this in your unit test.
275 // This should not be used in production code - call ToString() instead. 278 // This should not be used in production code - call ToString() instead.
276 void PrintTo(const Rect& rect, ::std::ostream* os); 279 void PrintTo(const Rect& rect, ::std::ostream* os);
277 280
278 } // namespace gfx 281 } // namespace gfx
279 282
280 #endif // UI_GFX_GEOMETRY_RECT_H_ 283 #endif // UI_GFX_GEOMETRY_RECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698