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

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

Issue 1061733002: Remove windows/mac/ios specific code from //ui (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix default try set Created 5 years, 8 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/codec/DEPS ('k') | ui/gfx/frame_time.h » ('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/display.h" 5 #include "ui/gfx/display.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return gfx::Insets(work_area_.y() - bounds_.y(), 100 return gfx::Insets(work_area_.y() - bounds_.y(),
101 work_area_.x() - bounds_.x(), 101 work_area_.x() - bounds_.x(),
102 bounds_.bottom() - work_area_.bottom(), 102 bounds_.bottom() - work_area_.bottom(),
103 bounds_.right() - work_area_.right()); 103 bounds_.right() - work_area_.right());
104 } 104 }
105 105
106 void Display::SetScaleAndBounds( 106 void Display::SetScaleAndBounds(
107 float device_scale_factor, 107 float device_scale_factor,
108 const gfx::Rect& bounds_in_pixel) { 108 const gfx::Rect& bounds_in_pixel) {
109 Insets insets = bounds_.InsetsFrom(work_area_); 109 Insets insets = bounds_.InsetsFrom(work_area_);
110 if (!HasForceDeviceScaleFactor()) { 110 if (!HasForceDeviceScaleFactor())
111 #if defined(OS_MACOSX)
112 // Unless an explicit scale factor was provided for testing, ensure the
113 // scale is integral.
114 device_scale_factor = static_cast<int>(device_scale_factor);
115 #endif
116 device_scale_factor_ = device_scale_factor; 111 device_scale_factor_ = device_scale_factor;
117 }
118 device_scale_factor_ = std::max(1.0f, device_scale_factor_); 112 device_scale_factor_ = std::max(1.0f, device_scale_factor_);
119 bounds_ = gfx::Rect( 113 bounds_ = gfx::Rect(
120 gfx::ToFlooredPoint(gfx::ScalePoint(bounds_in_pixel.origin(), 114 gfx::ToFlooredPoint(gfx::ScalePoint(bounds_in_pixel.origin(),
121 1.0f / device_scale_factor_)), 115 1.0f / device_scale_factor_)),
122 gfx::ToFlooredSize(gfx::ScaleSize(bounds_in_pixel.size(), 116 gfx::ToFlooredSize(gfx::ScaleSize(bounds_in_pixel.size(),
123 1.0f / device_scale_factor_))); 117 1.0f / device_scale_factor_)));
124 UpdateWorkAreaFromInsets(insets); 118 UpdateWorkAreaFromInsets(insets);
125 } 119 }
126 120
127 void Display::SetSize(const gfx::Size& size_in_pixel) { 121 void Display::SetSize(const gfx::Size& size_in_pixel) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 153
160 int64 Display::InternalDisplayId() { 154 int64 Display::InternalDisplayId() {
161 return internal_display_id_; 155 return internal_display_id_;
162 } 156 }
163 157
164 void Display::SetInternalDisplayId(int64 internal_display_id) { 158 void Display::SetInternalDisplayId(int64 internal_display_id) {
165 internal_display_id_ = internal_display_id; 159 internal_display_id_ = internal_display_id;
166 } 160 }
167 161
168 } // namespace gfx 162 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/codec/DEPS ('k') | ui/gfx/frame_time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698