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

Side by Side Diff: services/ui/ws/platform_display_default.cc

Issue 2547243002: Set device scale factor in CompositorFrame and scale frame size in WS. (Closed)
Patch Set: test Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/ui/ws/platform_display_default.h" 5 #include "services/ui/ws/platform_display_default.h"
6 6
7 #include "gpu/ipc/client/gpu_channel_host.h" 7 #include "gpu/ipc/client/gpu_channel_host.h"
8 #include "services/ui/display/screen_manager.h" 8 #include "services/ui/display/screen_manager.h"
9 #include "services/ui/ws/platform_display_init_params.h" 9 #include "services/ui/ws/platform_display_init_params.h"
10 #include "services/ui/ws/server_window.h" 10 #include "services/ui/ws/server_window.h"
(...skipping 18 matching lines...) Expand all
29 namespace ws { 29 namespace ws {
30 30
31 PlatformDisplayDefault::PlatformDisplayDefault( 31 PlatformDisplayDefault::PlatformDisplayDefault(
32 const PlatformDisplayInitParams& init_params) 32 const PlatformDisplayInitParams& init_params)
33 : display_id_(init_params.display_id), 33 : display_id_(init_params.display_id),
34 #if !defined(OS_ANDROID) 34 #if !defined(OS_ANDROID)
35 image_cursors_(new ImageCursors), 35 image_cursors_(new ImageCursors),
36 #endif 36 #endif
37 frame_generator_(new FrameGenerator(this, init_params.root_window)), 37 frame_generator_(new FrameGenerator(this, init_params.root_window)),
38 metrics_(init_params.metrics) { 38 metrics_(init_params.metrics) {
39 frame_generator_->set_device_scale_factor(
40 init_params.metrics.device_scale_factor);
39 } 41 }
40 42
41 PlatformDisplayDefault::~PlatformDisplayDefault() { 43 PlatformDisplayDefault::~PlatformDisplayDefault() {
42 // Don't notify the delegate from the destructor. 44 // Don't notify the delegate from the destructor.
43 delegate_ = nullptr; 45 delegate_ = nullptr;
44 46
45 frame_generator_.reset(); 47 frame_generator_.reset();
46 // Destroy the PlatformWindow early on as it may call us back during 48 // Destroy the PlatformWindow early on as it may call us back during
47 // destruction and we want to be in a known state. But destroy the surface 49 // destruction and we want to be in a known state. But destroy the surface
48 // first because it can still be using the platform window. 50 // first because it can still be using the platform window.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (metrics_ == metrics) 140 if (metrics_ == metrics)
139 return false; 141 return false;
140 142
141 gfx::Rect bounds = platform_window_->GetBounds(); 143 gfx::Rect bounds = platform_window_->GetBounds();
142 if (bounds.size() != metrics.pixel_size) { 144 if (bounds.size() != metrics.pixel_size) {
143 bounds.set_size(metrics.pixel_size); 145 bounds.set_size(metrics.pixel_size);
144 platform_window_->SetBounds(bounds); 146 platform_window_->SetBounds(bounds);
145 } 147 }
146 148
147 metrics_ = metrics; 149 metrics_ = metrics;
150 frame_generator_->set_device_scale_factor(metrics_.device_scale_factor);
148 return true; 151 return true;
149 } 152 }
150 153
151 const display::ViewportMetrics& PlatformDisplayDefault::GetViewportMetrics() 154 const display::ViewportMetrics& PlatformDisplayDefault::GetViewportMetrics()
152 const { 155 const {
153 return metrics_; 156 return metrics_;
154 } 157 }
155 158
156 void PlatformDisplayDefault::UpdateEventRootLocation(ui::LocatedEvent* event) { 159 void PlatformDisplayDefault::UpdateEventRootLocation(ui::LocatedEvent* event) {
157 gfx::Point location = event->location(); 160 gfx::Point location = event->location();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 246 }
244 247
245 void PlatformDisplayDefault::OnActivationChanged(bool active) {} 248 void PlatformDisplayDefault::OnActivationChanged(bool active) {}
246 249
247 bool PlatformDisplayDefault::IsInHighContrastMode() { 250 bool PlatformDisplayDefault::IsInHighContrastMode() {
248 return delegate_ ? delegate_->IsInHighContrastMode() : false; 251 return delegate_ ? delegate_->IsInHighContrastMode() : false;
249 } 252 }
250 253
251 } // namespace ws 254 } // namespace ws
252 } // namespace ui 255 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/frame_generator_unittest.cc ('k') | services/ui/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698