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

Side by Side Diff: ui/gfx/rect_conversions.cc

Issue 11235017: Revert to old rect conversion behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/rect_conversions.h ('k') | ui/gfx/rect_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/gfx/rect_conversions.h" 5 #include "ui/gfx/rect_conversions.h"
6 6
7 #include "ui/gfx/safe_integer_conversions.h" 7 #include "ui/gfx/safe_integer_conversions.h"
8 8
9 namespace gfx { 9 namespace gfx {
10 10
(...skipping 10 matching lines...) Expand all
21 Rect ToEnclosedRect(const RectF& rect) { 21 Rect ToEnclosedRect(const RectF& rect) {
22 int min_x = ToCeiledInt(rect.origin().x()); 22 int min_x = ToCeiledInt(rect.origin().x());
23 int min_y = ToCeiledInt(rect.origin().y()); 23 int min_y = ToCeiledInt(rect.origin().y());
24 float max_x = rect.origin().x() + rect.size().width(); 24 float max_x = rect.origin().x() + rect.size().width();
25 float max_y = rect.origin().y() + rect.size().height(); 25 float max_y = rect.origin().y() + rect.size().height();
26 int width = std::max(ToFlooredInt(max_x) - min_x, 0); 26 int width = std::max(ToFlooredInt(max_x) - min_x, 0);
27 int height = std::max(ToFlooredInt(max_y) - min_y, 0); 27 int height = std::max(ToFlooredInt(max_y) - min_y, 0);
28 return Rect(min_x, min_y, width, height); 28 return Rect(min_x, min_y, width, height);
29 } 29 }
30 30
31 Rect ToFlooredRectDeprecated(const RectF& rect) {
32 return Rect(ToFlooredInt(rect.origin().x()),
33 ToFlooredInt(rect.origin().y()),
34 ToFlooredInt(rect.size().width()),
35 ToFlooredInt(rect.size().height()));
36 }
37
31 } // namespace gfx 38 } // namespace gfx
32 39
OLDNEW
« no previous file with comments | « ui/gfx/rect_conversions.h ('k') | ui/gfx/rect_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698