| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 DCHECK(it->second); | 261 DCHECK(it->second); |
| 262 context_factory_->GetSurfaceManager()->UnregisterSurfaceNamespaceHierarchy( | 262 context_factory_->GetSurfaceManager()->UnregisterSurfaceNamespaceHierarchy( |
| 263 it->second, it->first); | 263 it->second, it->first); |
| 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 // Display properties are reset when the output surface is lost, so update it |
| 272 // the Compositor's. | 272 // to match 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 // Color space is reset when the output surface is lost, so this must also be |
| 346 // updated then. |
| 347 context_factory_->SetDisplayColorSpace(this, color_space_); |
| 344 } | 348 } |
| 345 | 349 |
| 346 void Compositor::SetBackgroundColor(SkColor color) { | 350 void Compositor::SetBackgroundColor(SkColor color) { |
| 347 host_->GetLayerTree()->set_background_color(color); | 351 host_->GetLayerTree()->set_background_color(color); |
| 348 ScheduleDraw(); | 352 ScheduleDraw(); |
| 349 } | 353 } |
| 350 | 354 |
| 351 void Compositor::SetVisible(bool visible) { | 355 void Compositor::SetVisible(bool visible) { |
| 352 host_->SetVisible(visible); | 356 host_->SetVisible(visible); |
| 353 // Visibility is reset when the output surface is lost, so this must also be | 357 // 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_, | 552 observer_list_, |
| 549 OnCompositingLockStateChanged(this)); | 553 OnCompositingLockStateChanged(this)); |
| 550 } | 554 } |
| 551 | 555 |
| 552 void Compositor::CancelCompositorLock() { | 556 void Compositor::CancelCompositorLock() { |
| 553 if (compositor_lock_) | 557 if (compositor_lock_) |
| 554 compositor_lock_->CancelLock(); | 558 compositor_lock_->CancelLock(); |
| 555 } | 559 } |
| 556 | 560 |
| 557 } // namespace ui | 561 } // namespace ui |
| OLD | NEW |