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

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: 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 16 matching lines...) Expand all
27 27
28 namespace ui { 28 namespace ui {
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 cursor_loader_(ui::CursorLoader::Create()), 35 cursor_loader_(ui::CursorLoader::Create()),
36 #endif 36 #endif
37 frame_generator_(new FrameGenerator(this, init_params.root_window)), 37 frame_generator_(
38 new FrameGenerator(this,
39 init_params.root_window,
40 init_params.metrics.device_scale_factor)),
38 metrics_(init_params.metrics) { 41 metrics_(init_params.metrics) {
39 } 42 }
40 43
41 PlatformDisplayDefault::~PlatformDisplayDefault() { 44 PlatformDisplayDefault::~PlatformDisplayDefault() {
42 // Don't notify the delegate from the destructor. 45 // Don't notify the delegate from the destructor.
43 delegate_ = nullptr; 46 delegate_ = nullptr;
44 47
45 frame_generator_.reset(); 48 frame_generator_.reset();
46 // Destroy the PlatformWindow early on as it may call us back during 49 // 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 50 // destruction and we want to be in a known state. But destroy the surface
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (metrics_ == metrics) 137 if (metrics_ == metrics)
135 return false; 138 return false;
136 139
137 gfx::Rect bounds = platform_window_->GetBounds(); 140 gfx::Rect bounds = platform_window_->GetBounds();
138 if (bounds.size() != metrics.pixel_size) { 141 if (bounds.size() != metrics.pixel_size) {
139 bounds.set_size(metrics.pixel_size); 142 bounds.set_size(metrics.pixel_size);
140 platform_window_->SetBounds(bounds); 143 platform_window_->SetBounds(bounds);
141 } 144 }
142 145
143 metrics_ = metrics; 146 metrics_ = metrics;
147 frame_generator_->UpdateDeviceScaleFactor(metrics_.device_scale_factor);
144 return true; 148 return true;
145 } 149 }
146 150
147 const display::ViewportMetrics& PlatformDisplayDefault::GetViewportMetrics() 151 const display::ViewportMetrics& PlatformDisplayDefault::GetViewportMetrics()
148 const { 152 const {
149 return metrics_; 153 return metrics_;
150 } 154 }
151 155
152 void PlatformDisplayDefault::UpdateEventRootLocation(ui::LocatedEvent* event) { 156 void PlatformDisplayDefault::UpdateEventRootLocation(ui::LocatedEvent* event) {
153 gfx::Point location = event->location(); 157 gfx::Point location = event->location();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 243 }
240 244
241 void PlatformDisplayDefault::OnActivationChanged(bool active) {} 245 void PlatformDisplayDefault::OnActivationChanged(bool active) {}
242 246
243 bool PlatformDisplayDefault::IsInHighContrastMode() { 247 bool PlatformDisplayDefault::IsInHighContrastMode() {
244 return delegate_ ? delegate_->IsInHighContrastMode() : false; 248 return delegate_ ? delegate_->IsInHighContrastMode() : false;
245 } 249 }
246 250
247 } // namespace ws 251 } // namespace ws
248 } // namespace ui 252 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698