| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); | 154 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); |
| 155 | 155 |
| 156 settings.use_zero_copy = IsUIZeroCopyEnabled(); | 156 settings.use_zero_copy = IsUIZeroCopyEnabled(); |
| 157 | 157 |
| 158 if (command_line->HasSwitch(switches::kUIEnableRGBA4444Textures)) | 158 if (command_line->HasSwitch(switches::kUIEnableRGBA4444Textures)) |
| 159 settings.renderer_settings.preferred_tile_format = cc::RGBA_4444; | 159 settings.renderer_settings.preferred_tile_format = cc::RGBA_4444; |
| 160 | 160 |
| 161 settings.use_layer_lists = | 161 settings.use_layer_lists = |
| 162 command_line->HasSwitch(cc::switches::kUIEnableLayerLists); | 162 command_line->HasSwitch(cc::switches::kUIEnableLayerLists); |
| 163 | 163 |
| 164 settings.enable_color_correct_rendering = | 164 settings.enable_color_correct_rasterization = |
| 165 command_line->HasSwitch(cc::switches::kEnableColorCorrectRendering) || | 165 command_line->HasSwitch(cc::switches::kEnableColorCorrectRendering) || |
| 166 command_line->HasSwitch(cc::switches::kEnableTrueColorRendering); | 166 command_line->HasSwitch(cc::switches::kEnableTrueColorRendering); |
| 167 settings.renderer_settings.enable_color_correct_rendering = | 167 settings.renderer_settings.enable_color_correct_rendering = |
| 168 settings.enable_color_correct_rendering || | 168 settings.enable_color_correct_rasterization || |
| 169 command_line->HasSwitch(switches::kEnableHDROutput); | 169 command_line->HasSwitch(switches::kEnableHDROutput); |
| 170 | 170 |
| 171 // UI compositor always uses partial raster if not using zero-copy. Zero copy | 171 // UI compositor always uses partial raster if not using zero-copy. Zero copy |
| 172 // doesn't currently support partial raster. | 172 // doesn't currently support partial raster. |
| 173 settings.use_partial_raster = !settings.use_zero_copy; | 173 settings.use_partial_raster = !settings.use_zero_copy; |
| 174 | 174 |
| 175 // Populate buffer_to_texture_target_map for all buffer usage/formats. | 175 // Populate buffer_to_texture_target_map for all buffer usage/formats. |
| 176 for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST); | 176 for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST); |
| 177 ++usage_idx) { | 177 ++usage_idx) { |
| 178 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx); | 178 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 } | 355 } |
| 356 | 356 |
| 357 void Compositor::SetDisplayColorSpace(const gfx::ColorSpace& color_space) { | 357 void Compositor::SetDisplayColorSpace(const gfx::ColorSpace& color_space) { |
| 358 blending_color_space_ = color_space; | 358 blending_color_space_ = color_space; |
| 359 output_color_space_ = color_space; | 359 output_color_space_ = color_space; |
| 360 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 360 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 361 switches::kEnableHDROutput)) { | 361 switches::kEnableHDROutput)) { |
| 362 blending_color_space_ = gfx::ColorSpace::CreateExtendedSRGB(); | 362 blending_color_space_ = gfx::ColorSpace::CreateExtendedSRGB(); |
| 363 output_color_space_ = gfx::ColorSpace::CreateSCRGBLinear(); | 363 output_color_space_ = gfx::ColorSpace::CreateSCRGBLinear(); |
| 364 } | 364 } |
| 365 host_->SetDeviceColorSpace(blending_color_space_); | 365 host_->SetRasterColorSpace(color_space); |
| 366 // Color space is reset when the output surface is lost, so this must also be | 366 // Color space is reset when the output surface is lost, so this must also be |
| 367 // updated then. | 367 // updated then. |
| 368 // TODO(fsamuel): Get rid of this. | 368 // TODO(fsamuel): Get rid of this. |
| 369 if (context_factory_private_) { | 369 if (context_factory_private_) { |
| 370 context_factory_private_->SetDisplayColorSpace(this, blending_color_space_, | 370 context_factory_private_->SetDisplayColorSpace(this, blending_color_space_, |
| 371 output_color_space_); | 371 output_color_space_); |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 | 374 |
| 375 void Compositor::SetBackgroundColor(SkColor color) { | 375 void Compositor::SetBackgroundColor(SkColor color) { |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 for (auto& observer : observer_list_) | 570 for (auto& observer : observer_list_) |
| 571 observer.OnCompositingLockStateChanged(this); | 571 observer.OnCompositingLockStateChanged(this); |
| 572 } | 572 } |
| 573 | 573 |
| 574 void Compositor::CancelCompositorLock() { | 574 void Compositor::CancelCompositorLock() { |
| 575 if (compositor_lock_) | 575 if (compositor_lock_) |
| 576 compositor_lock_->CancelLock(); | 576 compositor_lock_->CancelLock(); |
| 577 } | 577 } |
| 578 | 578 |
| 579 } // namespace ui | 579 } // namespace ui |
| OLD | NEW |