| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 DCHECK(it->second); | 260 DCHECK(it->second); |
| 261 context_factory_->GetSurfaceManager()->UnregisterSurfaceNamespaceHierarchy( | 261 context_factory_->GetSurfaceManager()->UnregisterSurfaceNamespaceHierarchy( |
| 262 it->second, it->first); | 262 it->second, it->first); |
| 263 surface_clients_.erase(it); | 263 surface_clients_.erase(it); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void Compositor::SetOutputSurface( | 266 void Compositor::SetOutputSurface( |
| 267 std::unique_ptr<cc::OutputSurface> output_surface) { | 267 std::unique_ptr<cc::OutputSurface> output_surface) { |
| 268 output_surface_requested_ = false; | 268 output_surface_requested_ = false; |
| 269 host_->SetOutputSurface(std::move(output_surface)); | 269 host_->SetOutputSurface(std::move(output_surface)); |
| 270 // Visibility is reset when the output surface is lost, so update it to match | 270 // Display properties are reset when the output surface is lost, so update it |
| 271 // the Compositor's. | 271 // to match the Compositor's. |
| 272 context_factory_->SetDisplayVisible(this, host_->IsVisible()); | 272 context_factory_->SetDisplayVisible(this, host_->IsVisible()); |
| 273 context_factory_->SetDisplayColorSpace(this, color_space_); |
| 273 } | 274 } |
| 274 | 275 |
| 275 void Compositor::ScheduleDraw() { | 276 void Compositor::ScheduleDraw() { |
| 276 host_->SetNeedsCommit(); | 277 host_->SetNeedsCommit(); |
| 277 } | 278 } |
| 278 | 279 |
| 279 void Compositor::SetRootLayer(Layer* root_layer) { | 280 void Compositor::SetRootLayer(Layer* root_layer) { |
| 280 if (root_layer_ == root_layer) | 281 if (root_layer_ == root_layer) |
| 281 return; | 282 return; |
| 282 if (root_layer_) | 283 if (root_layer_) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 333 } |
| 333 if (device_scale_factor_ != scale) { | 334 if (device_scale_factor_ != scale) { |
| 334 device_scale_factor_ = scale; | 335 device_scale_factor_ = scale; |
| 335 host_->GetLayerTree()->SetDeviceScaleFactor(scale); | 336 host_->GetLayerTree()->SetDeviceScaleFactor(scale); |
| 336 if (root_layer_) | 337 if (root_layer_) |
| 337 root_layer_->OnDeviceScaleFactorChanged(scale); | 338 root_layer_->OnDeviceScaleFactorChanged(scale); |
| 338 } | 339 } |
| 339 } | 340 } |
| 340 | 341 |
| 341 void Compositor::SetDisplayColorSpace(const gfx::ColorSpace& color_space) { | 342 void Compositor::SetDisplayColorSpace(const gfx::ColorSpace& color_space) { |
| 342 context_factory_->SetDisplayColorSpace(this, color_space); | 343 color_space_ = color_space; |
| 344 // Color space is reset when the output surface is lost, so this must also be |
| 345 // updated then. |
| 346 context_factory_->SetDisplayColorSpace(this, color_space_); |
| 343 } | 347 } |
| 344 | 348 |
| 345 void Compositor::SetBackgroundColor(SkColor color) { | 349 void Compositor::SetBackgroundColor(SkColor color) { |
| 346 host_->GetLayerTree()->set_background_color(color); | 350 host_->GetLayerTree()->set_background_color(color); |
| 347 ScheduleDraw(); | 351 ScheduleDraw(); |
| 348 } | 352 } |
| 349 | 353 |
| 350 void Compositor::SetVisible(bool visible) { | 354 void Compositor::SetVisible(bool visible) { |
| 351 host_->SetVisible(visible); | 355 host_->SetVisible(visible); |
| 352 // Visibility is reset when the output surface is lost, so this must also be | 356 // 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... |
| 547 observer_list_, | 551 observer_list_, |
| 548 OnCompositingLockStateChanged(this)); | 552 OnCompositingLockStateChanged(this)); |
| 549 } | 553 } |
| 550 | 554 |
| 551 void Compositor::CancelCompositorLock() { | 555 void Compositor::CancelCompositorLock() { |
| 552 if (compositor_lock_) | 556 if (compositor_lock_) |
| 553 compositor_lock_->CancelLock(); | 557 compositor_lock_->CancelLock(); |
| 554 } | 558 } |
| 555 | 559 |
| 556 } // namespace ui | 560 } // namespace ui |
| OLD | NEW |