OLD | NEW |
---|---|
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/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <deque> | 10 #include <deque> |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 surface_clients_.erase(it); | 264 surface_clients_.erase(it); |
265 } | 265 } |
266 | 266 |
267 void Compositor::SetOutputSurface( | 267 void Compositor::SetOutputSurface( |
268 std::unique_ptr<cc::OutputSurface> output_surface) { | 268 std::unique_ptr<cc::OutputSurface> output_surface) { |
269 output_surface_requested_ = false; | 269 output_surface_requested_ = false; |
270 host_->SetOutputSurface(std::move(output_surface)); | 270 host_->SetOutputSurface(std::move(output_surface)); |
271 // Visibility is reset when the output surface is lost, so update it to match | 271 // Visibility is reset when the output surface is lost, so update it to match |
272 // the Compositor's. | 272 // the Compositor's. |
273 context_factory_->SetDisplayVisible(this, host_->visible()); | 273 context_factory_->SetDisplayVisible(this, host_->visible()); |
274 context_factory_->SetDisplayColorSpace(this, color_space_); | |
274 } | 275 } |
275 | 276 |
276 void Compositor::ScheduleDraw() { | 277 void Compositor::ScheduleDraw() { |
277 host_->SetNeedsCommit(); | 278 host_->SetNeedsCommit(); |
278 } | 279 } |
279 | 280 |
280 void Compositor::SetRootLayer(Layer* root_layer) { | 281 void Compositor::SetRootLayer(Layer* root_layer) { |
281 if (root_layer_ == root_layer) | 282 if (root_layer_ == root_layer) |
282 return; | 283 return; |
283 if (root_layer_) | 284 if (root_layer_) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 } | 334 } |
334 if (device_scale_factor_ != scale) { | 335 if (device_scale_factor_ != scale) { |
335 device_scale_factor_ = scale; | 336 device_scale_factor_ = scale; |
336 host_->GetLayerTree()->SetDeviceScaleFactor(scale); | 337 host_->GetLayerTree()->SetDeviceScaleFactor(scale); |
337 if (root_layer_) | 338 if (root_layer_) |
338 root_layer_->OnDeviceScaleFactorChanged(scale); | 339 root_layer_->OnDeviceScaleFactorChanged(scale); |
339 } | 340 } |
340 } | 341 } |
341 | 342 |
342 void Compositor::SetDisplayColorSpace(const gfx::ColorSpace& color_space) { | 343 void Compositor::SetDisplayColorSpace(const gfx::ColorSpace& color_space) { |
343 context_factory_->SetDisplayColorSpace(this, color_space); | 344 color_space_ = color_space; |
345 context_factory_->SetDisplayColorSpace(this, color_space_); | |
danakj
2016/09/02 21:38:28
Can you leave a comment like in SetVisible, and al
hubbe
2016/09/02 22:30:47
Done.
| |
344 } | 346 } |
345 | 347 |
346 void Compositor::SetBackgroundColor(SkColor color) { | 348 void Compositor::SetBackgroundColor(SkColor color) { |
347 host_->GetLayerTree()->set_background_color(color); | 349 host_->GetLayerTree()->set_background_color(color); |
348 ScheduleDraw(); | 350 ScheduleDraw(); |
349 } | 351 } |
350 | 352 |
351 void Compositor::SetVisible(bool visible) { | 353 void Compositor::SetVisible(bool visible) { |
352 host_->SetVisible(visible); | 354 host_->SetVisible(visible); |
353 // Visibility is reset when the output surface is lost, so this must also be | 355 // Visibility is reset when the output surface is lost, so this must also be |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 observer_list_, | 550 observer_list_, |
549 OnCompositingLockStateChanged(this)); | 551 OnCompositingLockStateChanged(this)); |
550 } | 552 } |
551 | 553 |
552 void Compositor::CancelCompositorLock() { | 554 void Compositor::CancelCompositorLock() { |
553 if (compositor_lock_) | 555 if (compositor_lock_) |
554 compositor_lock_->CancelLock(); | 556 compositor_lock_->CancelLock(); |
555 } | 557 } |
556 | 558 |
557 } // namespace ui | 559 } // namespace ui |
OLD | NEW |