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

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

Issue 10221028: Move DIP translation from ui/aura to ui/compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gyp fix Created 8 years, 7 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 | Annotate | Revision Log
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/monitor.h" 5 #include "ui/gfx/monitor.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 float device_scale_factor, 62 float device_scale_factor,
63 const gfx::Rect& bounds_in_pixel) { 63 const gfx::Rect& bounds_in_pixel) {
64 Insets insets = bounds_.InsetsFrom(work_area_); 64 Insets insets = bounds_.InsetsFrom(work_area_);
65 device_scale_factor_ = device_scale_factor; 65 device_scale_factor_ = device_scale_factor;
66 #if defined(USE_AURA) 66 #if defined(USE_AURA)
67 bounds_in_pixel_ = bounds_in_pixel; 67 bounds_in_pixel_ = bounds_in_pixel;
68 #endif 68 #endif
69 // TODO(oshima): For m19, work area/monitor bounds that chrome/webapps sees 69 // TODO(oshima): For m19, work area/monitor bounds that chrome/webapps sees
70 // has (0, 0) origin because it's simpler and enough. Fix this when 70 // has (0, 0) origin because it's simpler and enough. Fix this when
71 // real multi monitor support is implemented. 71 // real multi monitor support is implemented.
72 #if defined(ENABLE_DIP)
73 bounds_ = gfx::Rect( 72 bounds_ = gfx::Rect(
74 bounds_in_pixel.size().Scale(1.0f / device_scale_factor_)); 73 bounds_in_pixel.size().Scale(1.0f / device_scale_factor_));
75 #else
76 bounds_ = gfx::Rect(bounds_in_pixel.size());
77 #endif
78 UpdateWorkAreaFromInsets(insets); 74 UpdateWorkAreaFromInsets(insets);
79 } 75 }
80 76
81 void Monitor::SetSize(const gfx::Size& size_in_pixel) { 77 void Monitor::SetSize(const gfx::Size& size_in_pixel) {
82 SetScaleAndBounds( 78 SetScaleAndBounds(
83 device_scale_factor_, 79 device_scale_factor_,
84 #if defined(USE_AURA) 80 #if defined(USE_AURA)
85 gfx::Rect(bounds_in_pixel_.origin(), size_in_pixel)); 81 gfx::Rect(bounds_in_pixel_.origin(), size_in_pixel));
86 #else 82 #else
87 gfx::Rect(bounds_.origin(), size_in_pixel)); 83 gfx::Rect(bounds_.origin(), size_in_pixel));
(...skipping 11 matching lines...) Expand all
99 95
100 std::string Monitor::ToString() const { 96 std::string Monitor::ToString() const {
101 return base::StringPrintf("Monitor[%d] bounds=%s, workarea=%s, scale=%f", 97 return base::StringPrintf("Monitor[%d] bounds=%s, workarea=%s, scale=%f",
102 id_, 98 id_,
103 bounds_.ToString().c_str(), 99 bounds_.ToString().c_str(),
104 work_area_.ToString().c_str(), 100 work_area_.ToString().c_str(),
105 device_scale_factor_); 101 device_scale_factor_);
106 } 102 }
107 103
108 } // namespace gfx 104 } // namespace gfx
OLDNEW
« ui/gfx/compositor/layer.cc ('K') | « ui/gfx/monitor.h ('k') | ui/gfx/monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698