| 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 23 matching lines...) Expand all Loading... |
| 34 #include "cc/trees/layer_tree_settings.h" | 34 #include "cc/trees/layer_tree_settings.h" |
| 35 #include "third_party/skia/include/core/SkBitmap.h" | 35 #include "third_party/skia/include/core/SkBitmap.h" |
| 36 #include "ui/base/ui_base_switches.h" | 36 #include "ui/base/ui_base_switches.h" |
| 37 #include "ui/compositor/compositor_observer.h" | 37 #include "ui/compositor/compositor_observer.h" |
| 38 #include "ui/compositor/compositor_switches.h" | 38 #include "ui/compositor/compositor_switches.h" |
| 39 #include "ui/compositor/compositor_vsync_manager.h" | 39 #include "ui/compositor/compositor_vsync_manager.h" |
| 40 #include "ui/compositor/dip_util.h" | 40 #include "ui/compositor/dip_util.h" |
| 41 #include "ui/compositor/layer.h" | 41 #include "ui/compositor/layer.h" |
| 42 #include "ui/compositor/layer_animator_collection.h" | 42 #include "ui/compositor/layer_animator_collection.h" |
| 43 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 43 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 44 #include "ui/gfx/icc_profile.h" |
| 44 #include "ui/gl/gl_switches.h" | 45 #include "ui/gl/gl_switches.h" |
| 45 | 46 |
| 46 namespace { | 47 namespace { |
| 47 | 48 |
| 48 const double kDefaultRefreshRate = 60.0; | 49 const double kDefaultRefreshRate = 60.0; |
| 49 const double kTestRefreshRate = 200.0; | 50 const double kTestRefreshRate = 200.0; |
| 50 | 51 |
| 51 } // namespace | 52 } // namespace |
| 52 | 53 |
| 53 namespace ui { | 54 namespace ui { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 context_factory_private_->ResizeDisplay(this, size_in_pixel); | 348 context_factory_private_->ResizeDisplay(this, size_in_pixel); |
| 348 } | 349 } |
| 349 if (device_scale_factor_ != scale) { | 350 if (device_scale_factor_ != scale) { |
| 350 device_scale_factor_ = scale; | 351 device_scale_factor_ = scale; |
| 351 host_->SetDeviceScaleFactor(scale); | 352 host_->SetDeviceScaleFactor(scale); |
| 352 if (root_layer_) | 353 if (root_layer_) |
| 353 root_layer_->OnDeviceScaleFactorChanged(scale); | 354 root_layer_->OnDeviceScaleFactorChanged(scale); |
| 354 } | 355 } |
| 355 } | 356 } |
| 356 | 357 |
| 357 void Compositor::SetDisplayColorSpace(const gfx::ColorSpace& color_space) { | 358 void Compositor::SetDisplayColorProfile(const gfx::ICCProfile& icc_profile) { |
| 358 blending_color_space_ = color_space; | 359 blending_color_space_ = icc_profile.GetColorSpace(); |
| 359 output_color_space_ = color_space; | 360 output_color_space_ = blending_color_space_; |
| 360 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 361 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 361 switches::kEnableHDROutput)) { | 362 switches::kEnableHDROutput)) { |
| 362 blending_color_space_ = gfx::ColorSpace::CreateExtendedSRGB(); | 363 blending_color_space_ = gfx::ColorSpace::CreateExtendedSRGB(); |
| 363 output_color_space_ = gfx::ColorSpace::CreateSCRGBLinear(); | 364 output_color_space_ = gfx::ColorSpace::CreateSCRGBLinear(); |
| 364 } | 365 } |
| 365 host_->SetRasterColorSpace(color_space); | 366 host_->SetRasterColorSpace(icc_profile.GetParametricColorSpace()); |
| 366 // Color space is reset when the output surface is lost, so this must also be | 367 // Color space is reset when the output surface is lost, so this must also be |
| 367 // updated then. | 368 // updated then. |
| 368 // TODO(fsamuel): Get rid of this. | 369 // TODO(fsamuel): Get rid of this. |
| 369 if (context_factory_private_) { | 370 if (context_factory_private_) { |
| 370 context_factory_private_->SetDisplayColorSpace(this, blending_color_space_, | 371 context_factory_private_->SetDisplayColorSpace(this, blending_color_space_, |
| 371 output_color_space_); | 372 output_color_space_); |
| 372 } | 373 } |
| 373 } | 374 } |
| 374 | 375 |
| 375 void Compositor::SetBackgroundColor(SkColor color) { | 376 void Compositor::SetBackgroundColor(SkColor color) { |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 for (auto& observer : observer_list_) | 571 for (auto& observer : observer_list_) |
| 571 observer.OnCompositingLockStateChanged(this); | 572 observer.OnCompositingLockStateChanged(this); |
| 572 } | 573 } |
| 573 | 574 |
| 574 void Compositor::CancelCompositorLock() { | 575 void Compositor::CancelCompositorLock() { |
| 575 if (compositor_lock_) | 576 if (compositor_lock_) |
| 576 compositor_lock_->CancelLock(); | 577 compositor_lock_->CancelLock(); |
| 577 } | 578 } |
| 578 | 579 |
| 579 } // namespace ui | 580 } // namespace ui |
| OLD | NEW |