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

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: comments 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 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_(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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (metrics_ == metrics) 136 if (metrics_ == metrics)
135 return false; 137 return false;
136 138
137 gfx::Rect bounds = platform_window_->GetBounds(); 139 gfx::Rect bounds = platform_window_->GetBounds();
138 if (bounds.size() != metrics.pixel_size) { 140 if (bounds.size() != metrics.pixel_size) {
139 bounds.set_size(metrics.pixel_size); 141 bounds.set_size(metrics.pixel_size);
140 platform_window_->SetBounds(bounds); 142 platform_window_->SetBounds(bounds);
141 } 143 }
142 144
143 metrics_ = metrics; 145 metrics_ = metrics;
146 frame_generator_->set_device_scale_factor(metrics_.device_scale_factor);
144 return true; 147 return true;
145 } 148 }
146 149
147 const display::ViewportMetrics& PlatformDisplayDefault::GetViewportMetrics() 150 const display::ViewportMetrics& PlatformDisplayDefault::GetViewportMetrics()
148 const { 151 const {
149 return metrics_; 152 return metrics_;
150 } 153 }
151 154
152 void PlatformDisplayDefault::UpdateEventRootLocation(ui::LocatedEvent* event) { 155 void PlatformDisplayDefault::UpdateEventRootLocation(ui::LocatedEvent* event) {
153 gfx::Point location = event->location(); 156 gfx::Point location = event->location();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 242 }
240 243
241 void PlatformDisplayDefault::OnActivationChanged(bool active) {} 244 void PlatformDisplayDefault::OnActivationChanged(bool active) {}
242 245
243 bool PlatformDisplayDefault::IsInHighContrastMode() { 246 bool PlatformDisplayDefault::IsInHighContrastMode() {
244 return delegate_ ? delegate_->IsInHighContrastMode() : false; 247 return delegate_ ? delegate_->IsInHighContrastMode() : false;
245 } 248 }
246 249
247 } // namespace ws 250 } // namespace ws
248 } // namespace ui 251 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698