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

Side by Side Diff: ui/gfx/win/dpi.cc

Issue 1357423009: gfx: Make conversions from Size to SizeF be explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sizefconvert-gfx: . Created 5 years, 2 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
« no previous file with comments | « ui/gfx/screen_android.cc ('k') | ui/ozone/demo/renderer_base.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/win/dpi.h" 5 #include "ui/gfx/win/dpi.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include "base/win/scoped_hdc.h" 8 #include "base/win/scoped_hdc.h"
9 #include "ui/gfx/display.h" 9 #include "ui/gfx/display.h"
10 #include "ui/gfx/geometry/point_conversions.h" 10 #include "ui/gfx/geometry/point_conversions.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 Rect DIPToScreenRect(const Rect& dip_bounds) { 87 Rect DIPToScreenRect(const Rect& dip_bounds) {
88 // See comment in ScreenToDIPRect for why we calculate size like this. 88 // See comment in ScreenToDIPRect for why we calculate size like this.
89 return Rect(DIPToScreenPoint(dip_bounds.origin()), 89 return Rect(DIPToScreenPoint(dip_bounds.origin()),
90 DIPToScreenSize(dip_bounds.size())); 90 DIPToScreenSize(dip_bounds.size()));
91 } 91 }
92 92
93 Size ScreenToDIPSize(const Size& size_in_pixels) { 93 Size ScreenToDIPSize(const Size& size_in_pixels) {
94 // Always ceil sizes. Otherwise we may be leaving off part of the bounds. 94 // Always ceil sizes. Otherwise we may be leaving off part of the bounds.
95 return ToCeiledSize(ScaleSize(size_in_pixels, 1.0f / GetDPIScale())); 95 return ScaleToCeiledSize(size_in_pixels, 1.0f / GetDPIScale());
96 } 96 }
97 97
98 Size DIPToScreenSize(const Size& dip_size) { 98 Size DIPToScreenSize(const Size& dip_size) {
99 // Always ceil sizes. Otherwise we may be leaving off part of the bounds. 99 // Always ceil sizes. Otherwise we may be leaving off part of the bounds.
100 return ToCeiledSize(ScaleSize(dip_size, GetDPIScale())); 100 return ScaleToCeiledSize(dip_size, GetDPIScale());
101 } 101 }
102 102
103 int GetSystemMetricsInDIP(int metric) { 103 int GetSystemMetricsInDIP(int metric) {
104 return static_cast<int>(GetSystemMetrics(metric) / GetDPIScale() + 0.5); 104 return static_cast<int>(GetSystemMetrics(metric) / GetDPIScale() + 0.5);
105 } 105 }
106 106
107 } // namespace win 107 } // namespace win
108 } // namespace gfx 108 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/screen_android.cc ('k') | ui/ozone/demo/renderer_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698