| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ash/display/display_color_manager_chromeos.h" | 5 #include "ash/display/display_color_manager_chromeos.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/format_macros.h" | 12 #include "base/format_macros.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 18 #include "base/task_runner_util.h" | 18 #include "base/task_runner_util.h" |
| 19 #include "base/threading/sequenced_worker_pool.h" | 19 #include "base/threading/sequenced_worker_pool.h" |
| 20 #include "chromeos/chromeos_paths.h" | 20 #include "chromeos/chromeos_paths.h" |
| 21 #include "chromeos/chromeos_switches.h" | |
| 22 #include "third_party/qcms/src/qcms.h" | 21 #include "third_party/qcms/src/qcms.h" |
| 23 #include "ui/display/types/display_snapshot.h" | 22 #include "ui/display/types/display_snapshot.h" |
| 24 #include "ui/display/types/gamma_ramp_rgb_entry.h" | 23 #include "ui/display/types/gamma_ramp_rgb_entry.h" |
| 25 #include "ui/display/types/native_display_delegate.h" | 24 #include "ui/display/types/native_display_delegate.h" |
| 26 #include "ui/gfx/display.h" | 25 #include "ui/gfx/display.h" |
| 27 #include "ui/gfx/screen.h" | 26 #include "ui/gfx/screen.h" |
| 28 | 27 |
| 29 namespace ash { | 28 namespace ash { |
| 30 | 29 |
| 31 namespace { | 30 namespace { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 60 for (size_t i = 0; i < vcgt_channel_length; ++i) { | 59 for (size_t i = 0; i < vcgt_channel_length; ++i) { |
| 61 data->lut[i].r = vcgt_data[i]; | 60 data->lut[i].r = vcgt_data[i]; |
| 62 data->lut[i].g = vcgt_data[vcgt_channel_length + i]; | 61 data->lut[i].g = vcgt_data[vcgt_channel_length + i]; |
| 63 data->lut[i].b = vcgt_data[(vcgt_channel_length * 2) + i]; | 62 data->lut[i].b = vcgt_data[(vcgt_channel_length * 2) + i]; |
| 64 } | 63 } |
| 65 qcms_profile_release(display_profile); | 64 qcms_profile_release(display_profile); |
| 66 return true; | 65 return true; |
| 67 } | 66 } |
| 68 | 67 |
| 69 base::FilePath PathForDisplaySnapshot(const ui::DisplaySnapshot* snapshot) { | 68 base::FilePath PathForDisplaySnapshot(const ui::DisplaySnapshot* snapshot) { |
| 70 if (gfx::Display::IsInternalDisplayId(snapshot->display_id())) { | |
| 71 const base::CommandLine* command_line = | |
| 72 base::CommandLine::ForCurrentProcess(); | |
| 73 if (command_line->HasSwitch( | |
| 74 chromeos::switches::kInternalDisplayColorProfileFile)) { | |
| 75 const base::FilePath& path = command_line->GetSwitchValuePath( | |
| 76 chromeos::switches::kInternalDisplayColorProfileFile); | |
| 77 return base::FilePath(path); | |
| 78 } | |
| 79 } | |
| 80 | |
| 81 base::FilePath path; | 69 base::FilePath path; |
| 82 CHECK( | 70 CHECK( |
| 83 PathService::Get(chromeos::DIR_DEVICE_COLOR_CALIBRATION_PROFILES, &path)); | 71 PathService::Get(chromeos::DIR_DEVICE_COLOR_CALIBRATION_PROFILES, &path)); |
| 84 path = path.Append( | 72 path = path.Append( |
| 85 base::StringPrintf("%08" PRIx64 ".icc", snapshot->product_id())); | 73 base::StringPrintf("%08" PRIx64 ".icc", snapshot->product_id())); |
| 86 return path; | 74 return path; |
| 87 } | 75 } |
| 88 | 76 |
| 89 } // namespace | 77 } // namespace |
| 90 | 78 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 calibration_map_[product_id] = data.release(); | 142 calibration_map_[product_id] = data.release(); |
| 155 ApplyDisplayColorCalibration(display_id, product_id); | 143 ApplyDisplayColorCalibration(display_id, product_id); |
| 156 } | 144 } |
| 157 } | 145 } |
| 158 | 146 |
| 159 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {} | 147 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {} |
| 160 | 148 |
| 161 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {} | 149 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {} |
| 162 | 150 |
| 163 } // namespace ash | 151 } // namespace ash |
| OLD | NEW |