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

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

Issue 16336027: Enable high dpi in win/views. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove some extraneous code. Created 7 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 #include "ui/gfx/rect_conversions.h" 5 #include "ui/gfx/rect_conversions.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/gfx/point_conversions.h"
10 #include "ui/gfx/safe_integer_conversions.h" 11 #include "ui/gfx/safe_integer_conversions.h"
12 #include "ui/gfx/size_conversions.h"
11 13
12 namespace gfx { 14 namespace gfx {
13 15
16 Rect ToSizedRect(const RectF& rect) {
kevers 2013/06/06 13:32:33 See comment for header file change.
girard 2013/06/10 14:27:56 Done (reverted).
17 return Rect(ToFlooredPoint(rect.origin()),ToCeiledSize(rect.size()));
18 }
19
14 Rect ToEnclosingRect(const RectF& rect) { 20 Rect ToEnclosingRect(const RectF& rect) {
15 int min_x = ToFlooredInt(rect.x()); 21 int min_x = ToFlooredInt(rect.x());
16 int min_y = ToFlooredInt(rect.y()); 22 int min_y = ToFlooredInt(rect.y());
17 float max_x = rect.right(); 23 float max_x = rect.right();
18 float max_y = rect.bottom(); 24 float max_y = rect.bottom();
19 int width = rect.width() == 0 ? 0 : std::max(ToCeiledInt(max_x) - min_x, 0); 25 int width = rect.width() == 0 ? 0 : std::max(ToCeiledInt(max_x) - min_x, 0);
20 int height = rect.height() == 0 ? 0 : std::max(ToCeiledInt(max_y) - min_y, 0); 26 int height = rect.height() == 0 ? 0 : std::max(ToCeiledInt(max_y) - min_y, 0);
21 return Rect(min_x, min_y, width, height); 27 return Rect(min_x, min_y, width, height);
22 } 28 }
23 29
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 78
73 Rect ToFlooredRectDeprecated(const RectF& rect) { 79 Rect ToFlooredRectDeprecated(const RectF& rect) {
74 return Rect(ToFlooredInt(rect.x()), 80 return Rect(ToFlooredInt(rect.x()),
75 ToFlooredInt(rect.y()), 81 ToFlooredInt(rect.y()),
76 ToFlooredInt(rect.width()), 82 ToFlooredInt(rect.width()),
77 ToFlooredInt(rect.height())); 83 ToFlooredInt(rect.height()));
78 } 84 }
79 85
80 } // namespace gfx 86 } // namespace gfx
81 87
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698